apply from: 'version.gradle'
-test {
+task parallelTest(type: Test) {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
+ useJUnit {
+ excludeCategories 'net.pterodactylus.sone.test.NotParallel'
+ }
+}
+
+task notParallelTest(type: Test) {
+ maxParallelForks = 1
+ useJUnit {
+ includeCategories 'net.pterodactylus.sone.test.NotParallel'
+ }
+}
+
+test {
+ exclude '**'
+ dependsOn parallelTest, notParallelTest
}
task fatJar(type: Jar) {
import net.pterodactylus.util.version.Version
import org.hamcrest.MatcherAssert.*
import org.hamcrest.Matchers.*
+import org.junit.experimental.categories.*
import org.mockito.Mockito.*
import java.io.*
import java.util.concurrent.*
const val versionString = "v80"
+@Category(NotParallel::class)
class SoneModuleTest {
private val currentDir: File = File(".")
import net.pterodactylus.sone.web.notification.*
import org.hamcrest.MatcherAssert.*
import org.hamcrest.Matchers.*
+import org.junit.experimental.categories.*
import org.mockito.Mockito.*
import java.io.*
import java.util.concurrent.atomic.*
* Unit test for [SonePlugin].
*/
@Dirty
+@Category(NotParallel::class)
class SonePluginTest {
private var sonePlugin = SonePlugin { injector }
--- /dev/null
+package net.pterodactylus.sone.test
+
+/**
+ * Marker class for a JUnit [org.junit.experimental.categories.Category], to
+ * mark tests that should not be run parallel to other tests.
+ */
+class NotParallel
+