diff --git a/build.gradle.kts b/build.gradle.kts index 48dfed94..531821a2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,7 +39,7 @@ repositories { tasks.withType { kotlinOptions { jvmTarget = "1.8" - freeCompilerArgs = listOf("-Xjsr305-annotations=enable") + freeCompilerArgs = listOf("-Xjsr305-annotations=enable") } } @@ -57,18 +57,24 @@ dependencies { } compileOnly("org.springframework:spring-context-indexer") compile("org.springframework.boot:spring-boot-starter-data-mongodb-reactive") - testCompile("org.springframework.boot:spring-boot-starter-test") + runtime("de.flapdoodle.embed:de.flapdoodle.embed.mongo") compile("com.samskivert:jmustache:1.13") compile("com.atlassian.commonmark:commonmark:0.9.0") compile("com.atlassian.commonmark:commonmark-ext-autolink:0.9.0") - compile("com.google.code.findbugs:jsr305:3.0.2") // Needed for now, could be removed when KT-19419 will be fixed - - testCompile("io.projectreactor:reactor-test") + compile("com.google.code.findbugs:jsr305:3.0.2") // Needed for now, could be removed when KT-19419 will be fixed compile("com.fasterxml.jackson.module:jackson-module-kotlin") compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") + + testCompile("org.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } + testCompile("org.junit.jupiter:junit-jupiter-api") + testRuntime("org.junit.jupiter:junit-jupiter-engine") + testRuntime("org.junit.platform:junit-platform-launcher") + testCompile("io.projectreactor:reactor-test") } task("gulpBuild") { diff --git a/src/test/kotlin/mixit/integration/AbstractIntegrationTests.kt b/src/test/kotlin/mixit/integration/AbstractIntegrationTests.kt index c9f054c6..4b8bb789 100644 --- a/src/test/kotlin/mixit/integration/AbstractIntegrationTests.kt +++ b/src/test/kotlin/mixit/integration/AbstractIntegrationTests.kt @@ -1,14 +1,14 @@ package mixit.integration -import org.junit.Before -import org.junit.runner.RunWith +import org.junit.jupiter.api.BeforeAll +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.context.SpringBootTest.WebEnvironment import org.springframework.boot.web.server.LocalServerPort -import org.springframework.test.context.junit4.SpringRunner +import org.springframework.test.context.junit.jupiter.SpringExtension import org.springframework.web.reactive.function.client.WebClient -@RunWith(SpringRunner::class) +@ExtendWith(SpringExtension::class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) abstract class AbstractIntegrationTests { @@ -17,7 +17,7 @@ abstract class AbstractIntegrationTests { lateinit var client: WebClient - @Before + @BeforeAll fun setup() { client = WebClient.create("http://localhost:$port") } diff --git a/src/test/kotlin/mixit/integration/EventIntegrationTests.kt b/src/test/kotlin/mixit/integration/EventIntegrationTests.kt index 49be815a..7c2d2491 100644 --- a/src/test/kotlin/mixit/integration/EventIntegrationTests.kt +++ b/src/test/kotlin/mixit/integration/EventIntegrationTests.kt @@ -1,9 +1,8 @@ package mixit.integration import mixit.model.Event -import org.junit.Assert.assertEquals -import org.junit.Assert.assertFalse -import org.junit.Test +import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Test import org.springframework.http.MediaType.APPLICATION_JSON import org.springframework.web.reactive.function.client.bodyToMono import org.springframework.web.reactive.function.client.bodyToFlux diff --git a/src/test/kotlin/mixit/integration/TalkIntegrationTests.kt b/src/test/kotlin/mixit/integration/TalkIntegrationTests.kt index e48b50c9..601ef051 100644 --- a/src/test/kotlin/mixit/integration/TalkIntegrationTests.kt +++ b/src/test/kotlin/mixit/integration/TalkIntegrationTests.kt @@ -1,8 +1,8 @@ package mixit.integration import mixit.model.Talk -import org.junit.Assert.assertEquals -import org.junit.Test +import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Test import org.springframework.http.MediaType.APPLICATION_JSON import org.springframework.web.reactive.function.client.bodyToFlux import reactor.test.test diff --git a/src/test/kotlin/mixit/integration/UserIntegrationTests.kt b/src/test/kotlin/mixit/integration/UserIntegrationTests.kt index 971daadd..7cd2f3b1 100644 --- a/src/test/kotlin/mixit/integration/UserIntegrationTests.kt +++ b/src/test/kotlin/mixit/integration/UserIntegrationTests.kt @@ -2,9 +2,8 @@ package mixit.integration import mixit.model.Role import mixit.model.User -import org.junit.Assert.assertEquals -import org.junit.Assert.assertTrue -import org.junit.Test +import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Test import org.springframework.http.MediaType.APPLICATION_JSON import org.springframework.web.reactive.function.client.bodyToFlux import org.springframework.web.reactive.function.client.bodyToMono diff --git a/src/test/kotlin/mixit/integration/WebsiteIntegrationTests.kt b/src/test/kotlin/mixit/integration/WebsiteIntegrationTests.kt index 24b09f0f..5e2638c1 100644 --- a/src/test/kotlin/mixit/integration/WebsiteIntegrationTests.kt +++ b/src/test/kotlin/mixit/integration/WebsiteIntegrationTests.kt @@ -1,6 +1,6 @@ package mixit.integration -import org.junit.Test +import org.junit.jupiter.api.Test import org.springframework.http.HttpStatus.* import org.springframework.http.MediaType.* import reactor.test.test diff --git a/src/test/kotlin/mixit/util/ExtensionsTest.kt b/src/test/kotlin/mixit/util/ExtensionsTest.kt index ce9cb725..de346bbd 100644 --- a/src/test/kotlin/mixit/util/ExtensionsTest.kt +++ b/src/test/kotlin/mixit/util/ExtensionsTest.kt @@ -1,8 +1,7 @@ package mixit.util -import org.junit.Test - -import org.junit.Assert.* +import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Test /** * Unit tests for Extensions diff --git a/src/test/resources/junit-platform.properties b/src/test/resources/junit-platform.properties new file mode 100644 index 00000000..e6d55f8b --- /dev/null +++ b/src/test/resources/junit-platform.properties @@ -0,0 +1 @@ +junit.jupiter.testinstance.lifecycle.default = per_class \ No newline at end of file