diff --git a/build.gradle b/build.gradle index 843a33d5..597926c6 100644 --- a/build.gradle +++ b/build.gradle @@ -28,6 +28,10 @@ gradle.taskGraph.whenReady { graph -> subprojects { plugins.withType(JavaPlugin) { sourceCompatibility = 1.8 + + test { + useJUnitPlatform() + } } plugins.withType(JacocoPlugin) { tasks.withType(Test) { diff --git a/docs/spring-session-docs.gradle b/docs/spring-session-docs.gradle index 47c813cd..c0a52700 100644 --- a/docs/spring-session-docs.gradle +++ b/docs/spring-session-docs.gradle @@ -13,13 +13,14 @@ dependencies { testCompile 'org.springframework.security:spring-security-config' testCompile 'org.springframework.security:spring-security-web' testCompile 'org.springframework.security:spring-security-test' - testCompile 'junit:junit' testCompile 'org.mockito:mockito-core' testCompile 'org.springframework:spring-test' testCompile 'org.assertj:assertj-core' testCompile 'com.hazelcast:hazelcast' testCompile 'io.lettuce:lettuce-core' testCompile 'javax.servlet:javax.servlet-api' + testCompile 'org.junit.jupiter:junit-jupiter-api' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' } def versions = dependencyManagement.managedVersions diff --git a/docs/src/test/java/docs/FindByIndexNameSessionRepositoryTests.java b/docs/src/test/java/docs/FindByIndexNameSessionRepositoryTests.java index 4c87a694..9d6ea283 100644 --- a/docs/src/test/java/docs/FindByIndexNameSessionRepositoryTests.java +++ b/docs/src/test/java/docs/FindByIndexNameSessionRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,10 @@ package docs; import java.util.Map; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.session.FindByIndexNameSessionRepository; import org.springframework.session.Session; @@ -30,13 +30,17 @@ import org.springframework.session.Session; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) public class FindByIndexNameSessionRepositoryTests { @Mock FindByIndexNameSessionRepository sessionRepository; @Mock Session session; + @BeforeEach + void setUp() { + MockitoAnnotations.initMocks(this); + } + @Test public void setUsername() { // tag::set-username[] diff --git a/docs/src/test/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java b/docs/src/test/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java index f305a7d9..9d09145a 100644 --- a/docs/src/test/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java +++ b/docs/src/test/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,15 +16,15 @@ package docs; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.session.Session; import org.springframework.session.web.http.SessionRepositoryFilter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -33,7 +33,7 @@ import static org.mockito.Mockito.mock; /** * @author Rob Winch */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class HttpSessionConfigurationNoOpConfigureRedisActionXmlTests { diff --git a/docs/src/test/java/docs/IndexDocTests.java b/docs/src/test/java/docs/IndexDocTests.java index 2e47cc99..cfbcc866 100644 --- a/docs/src/test/java/docs/IndexDocTests.java +++ b/docs/src/test/java/docs/IndexDocTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap; import com.hazelcast.config.Config; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.core.ReactiveRedisTemplate; diff --git a/docs/src/test/java/docs/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java b/docs/src/test/java/docs/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java index d2bf7f00..e6a143bf 100644 --- a/docs/src/test/java/docs/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java +++ b/docs/src/test/java/docs/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package docs; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -25,7 +25,7 @@ import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.session.data.redis.config.ConfigureRedisAction; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.mockito.Mockito.mock; @@ -33,7 +33,7 @@ import static org.mockito.Mockito.mock; /** * @author Rob Winch */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class RedisHttpSessionConfigurationNoOpConfigureRedisActionTests { diff --git a/docs/src/test/java/docs/http/AbstractHttpSessionListenerTests.java b/docs/src/test/java/docs/http/AbstractHttpSessionListenerTests.java index 8569a179..6eb5aa3b 100644 --- a/docs/src/test/java/docs/http/AbstractHttpSessionListenerTests.java +++ b/docs/src/test/java/docs/http/AbstractHttpSessionListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package docs.http; import java.util.Properties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; @@ -29,7 +29,7 @@ import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.security.core.session.SessionDestroyedEvent; import org.springframework.session.MapSession; import org.springframework.session.Session; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -42,7 +42,7 @@ import static org.mockito.Mockito.mock; * @author Mark Paluch * @since 1.2 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration public abstract class AbstractHttpSessionListenerTests { @Autowired diff --git a/docs/src/test/java/docs/security/RememberMeSecurityConfigurationTests.java b/docs/src/test/java/docs/security/RememberMeSecurityConfigurationTests.java index 9559535e..502fdebf 100644 --- a/docs/src/test/java/docs/security/RememberMeSecurityConfigurationTests.java +++ b/docs/src/test/java/docs/security/RememberMeSecurityConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,16 +21,16 @@ import java.util.Base64; import javax.servlet.http.Cookie; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.session.Session; import org.springframework.session.SessionRepository; import org.springframework.session.web.http.SessionRepositoryFilter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; @@ -45,7 +45,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv * @author rwinch * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = RememberMeSecurityConfiguration.class) @WebAppConfiguration @SuppressWarnings("rawtypes") @@ -59,7 +59,7 @@ public class RememberMeSecurityConfigurationTests { MockMvc mockMvc; - @Before + @BeforeEach public void setup() { // @formatter:off this.mockMvc = MockMvcBuilders diff --git a/docs/src/test/java/docs/security/RememberMeSecurityConfigurationXmlTests.java b/docs/src/test/java/docs/security/RememberMeSecurityConfigurationXmlTests.java index da8038af..250684f0 100644 --- a/docs/src/test/java/docs/security/RememberMeSecurityConfigurationXmlTests.java +++ b/docs/src/test/java/docs/security/RememberMeSecurityConfigurationXmlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,16 +21,16 @@ import java.util.Base64; import javax.servlet.http.Cookie; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.session.Session; import org.springframework.session.SessionRepository; import org.springframework.session.web.http.SessionRepositoryFilter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; @@ -45,7 +45,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv * @author rwinch * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration @SuppressWarnings("rawtypes") @@ -59,7 +59,7 @@ public class RememberMeSecurityConfigurationXmlTests { MockMvc mockMvc; - @Before + @BeforeEach public void setup() { // @formatter:off this.mockMvc = MockMvcBuilders diff --git a/gradle/dependency-management.gradle b/gradle/dependency-management.gradle index 89321e6d..fd0e64dc 100644 --- a/gradle/dependency-management.gradle +++ b/gradle/dependency-management.gradle @@ -2,6 +2,7 @@ dependencyManagement { imports { mavenBom 'com.fasterxml.jackson:jackson-bom:2.9.6' mavenBom 'io.projectreactor:reactor-bom:Dysprosium-BUILD-SNAPSHOT' + mavenBom 'org.junit:junit-bom:5.4.2' mavenBom 'org.springframework:spring-framework-bom:5.2.0.BUILD-SNAPSHOT' mavenBom 'org.springframework.data:spring-data-releasetrain:Moore-BUILD-SNAPSHOT' mavenBom 'org.springframework.security:spring-security-bom:5.2.0.BUILD-SNAPSHOT' @@ -21,7 +22,6 @@ dependencyManagement { dependency 'io.lettuce:lettuce-core:5.1.6.RELEASE' dependency 'javax.annotation:javax.annotation-api:1.3.2' dependency 'javax.servlet:javax.servlet-api:4.0.1' - dependency 'junit:junit:4.12' dependency 'mysql:mysql-connector-java:8.0.16' dependency 'org.apache.derby:derby:10.14.2.0' dependency 'org.assertj:assertj-core:3.12.2' diff --git a/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle b/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle index d95d5085..485447b1 100644 --- a/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle +++ b/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle @@ -16,6 +16,8 @@ dependencies { testCompile "org.springframework.boot:spring-boot-starter-test" testCompile "org.assertj:assertj-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies integrationTestCompile "org.testcontainers:testcontainers" diff --git a/samples/boot/findbyusername/src/integration-test/java/sample/FindByUsernameTests.java b/samples/boot/findbyusername/src/integration-test/java/sample/FindByUsernameTests.java index f8570608..4c5e3798 100644 --- a/samples/boot/findbyusername/src/integration-test/java/sample/FindByUsernameTests.java +++ b/samples/boot/findbyusername/src/integration-test/java/sample/FindByUsernameTests.java @@ -16,10 +16,10 @@ package sample; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import org.testcontainers.containers.GenericContainer; import sample.pages.HomePage; @@ -32,7 +32,7 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder; @@ -41,7 +41,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr * @author Rob Winch * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @AutoConfigureMockMvc @SpringBootTest(webEnvironment = WebEnvironment.MOCK) public class FindByUsernameTests { @@ -53,12 +53,12 @@ public class FindByUsernameTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/boot/findbyusername/src/test/java/sample/session/SessionDetailsFilterTests.java b/samples/boot/findbyusername/src/test/java/sample/session/SessionDetailsFilterTests.java index a9d332f9..4f621078 100644 --- a/samples/boot/findbyusername/src/test/java/sample/session/SessionDetailsFilterTests.java +++ b/samples/boot/findbyusername/src/test/java/sample/session/SessionDetailsFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,14 @@ package sample.session; import com.maxmind.geoip2.DatabaseReader; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import sample.config.GeoConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = GeoConfig.class) public class SessionDetailsFilterTests { @Autowired @@ -40,7 +40,7 @@ public class SessionDetailsFilterTests { SessionDetailsFilter filter; - @Before + @BeforeEach public void setup() { this.filter = new SessionDetailsFilter(this.reader); } diff --git a/samples/boot/jdbc/spring-session-sample-boot-jdbc.gradle b/samples/boot/jdbc/spring-session-sample-boot-jdbc.gradle index e07f0313..66a02725 100644 --- a/samples/boot/jdbc/spring-session-sample-boot-jdbc.gradle +++ b/samples/boot/jdbc/spring-session-sample-boot-jdbc.gradle @@ -14,6 +14,8 @@ dependencies { testCompile "org.springframework.boot:spring-boot-starter-test" testCompile "org.assertj:assertj-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies } diff --git a/samples/boot/jdbc/src/integration-test/java/sample/BootTests.java b/samples/boot/jdbc/src/integration-test/java/sample/BootTests.java index 75a8c71b..70999917 100644 --- a/samples/boot/jdbc/src/integration-test/java/sample/BootTests.java +++ b/samples/boot/jdbc/src/integration-test/java/sample/BootTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,10 @@ package sample; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import sample.pages.HomePage; import sample.pages.LoginPage; @@ -28,7 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder; @@ -36,7 +36,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr * @author Eddú Meléndez * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @AutoConfigureMockMvc @SpringBootTest(webEnvironment = WebEnvironment.MOCK) public class BootTests { @@ -46,12 +46,12 @@ public class BootTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/boot/redis-json/spring-session-sample-boot-redis-json.gradle b/samples/boot/redis-json/spring-session-sample-boot-redis-json.gradle index f0515bec..b13c0d9f 100644 --- a/samples/boot/redis-json/spring-session-sample-boot-redis-json.gradle +++ b/samples/boot/redis-json/spring-session-sample-boot-redis-json.gradle @@ -16,6 +16,8 @@ dependencies { testCompile "org.springframework.boot:spring-boot-starter-test" testCompile "org.assertj:assertj-core" testCompile "org.skyscreamer:jsonassert" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies integrationTestCompile "org.testcontainers:testcontainers" diff --git a/samples/boot/redis-json/src/integration-test/java/sample/HttpRedisJsonTest.java b/samples/boot/redis-json/src/integration-test/java/sample/HttpRedisJsonTest.java index b10af5d4..3230112e 100644 --- a/samples/boot/redis-json/src/integration-test/java/sample/HttpRedisJsonTest.java +++ b/samples/boot/redis-json/src/integration-test/java/sample/HttpRedisJsonTest.java @@ -18,10 +18,10 @@ package sample; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import org.testcontainers.containers.GenericContainer; import sample.pages.HomePage; @@ -35,7 +35,7 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder; @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Eddú Meléndez * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.MOCK) @AutoConfigureMockMvc public class HttpRedisJsonTest { @@ -57,12 +57,12 @@ public class HttpRedisJsonTest { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/boot/redis-json/src/integration-test/java/sample/RedisSerializerTest.java b/samples/boot/redis-json/src/integration-test/java/sample/RedisSerializerTest.java index 3be52dcc..cb27bad8 100644 --- a/samples/boot/redis-json/src/integration-test/java/sample/RedisSerializerTest.java +++ b/samples/boot/redis-json/src/integration-test/java/sample/RedisSerializerTest.java @@ -16,8 +16,8 @@ package sample; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.GenericContainer; import org.springframework.boot.test.context.SpringBootTest; @@ -27,7 +27,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; import org.springframework.session.data.redis.config.annotation.SpringSessionRedisOperations; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author jitendra * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest public class RedisSerializerTest { diff --git a/samples/boot/redis/spring-session-sample-boot-redis.gradle b/samples/boot/redis/spring-session-sample-boot-redis.gradle index 76f97632..8fc1b067 100644 --- a/samples/boot/redis/spring-session-sample-boot-redis.gradle +++ b/samples/boot/redis/spring-session-sample-boot-redis.gradle @@ -13,6 +13,8 @@ dependencies { compile "org.webjars:webjars-locator-core" testCompile "org.springframework.boot:spring-boot-starter-test" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies integrationTestCompile "org.testcontainers:testcontainers" diff --git a/samples/boot/redis/src/integration-test/java/sample/BootTests.java b/samples/boot/redis/src/integration-test/java/sample/BootTests.java index df2ac5e1..8e3b8f03 100644 --- a/samples/boot/redis/src/integration-test/java/sample/BootTests.java +++ b/samples/boot/redis/src/integration-test/java/sample/BootTests.java @@ -16,10 +16,10 @@ package sample; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import org.testcontainers.containers.GenericContainer; import sample.pages.HomePage; @@ -32,7 +32,7 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder; @@ -40,7 +40,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr * @author Eddú Meléndez * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @AutoConfigureMockMvc @SpringBootTest(webEnvironment = WebEnvironment.MOCK) public class BootTests { @@ -52,12 +52,12 @@ public class BootTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/boot/webflux/spring-session-sample-boot-webflux.gradle b/samples/boot/webflux/spring-session-sample-boot-webflux.gradle index 11201e2b..28ff3280 100644 --- a/samples/boot/webflux/spring-session-sample-boot-webflux.gradle +++ b/samples/boot/webflux/spring-session-sample-boot-webflux.gradle @@ -9,6 +9,8 @@ dependencies { compile 'org.webjars:bootstrap' testCompile "org.springframework.boot:spring-boot-starter-test" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies integrationTestCompile "org.testcontainers:testcontainers" diff --git a/samples/boot/webflux/src/integration-test/java/sample/AttributeTests.java b/samples/boot/webflux/src/integration-test/java/sample/AttributeTests.java index e9480ec1..984e7f23 100644 --- a/samples/boot/webflux/src/integration-test/java/sample/AttributeTests.java +++ b/samples/boot/webflux/src/integration-test/java/sample/AttributeTests.java @@ -18,10 +18,10 @@ package sample; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.testcontainers.containers.GenericContainer; @@ -34,7 +34,7 @@ import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class AttributeTests { @@ -54,12 +54,12 @@ public class AttributeTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = new HtmlUnitDriver(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/boot/websocket/spring-session-sample-boot-websocket.gradle b/samples/boot/websocket/spring-session-sample-boot-websocket.gradle index 6093da3b..e396dc6e 100644 --- a/samples/boot/websocket/spring-session-sample-boot-websocket.gradle +++ b/samples/boot/websocket/spring-session-sample-boot-websocket.gradle @@ -23,6 +23,8 @@ dependencies { testCompile "org.springframework.boot:spring-boot-starter-test" testCompile "org.springframework.security:spring-security-test" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile "org.testcontainers:testcontainers" } diff --git a/samples/boot/websocket/src/integration-test/java/sample/ApplicationTests.java b/samples/boot/websocket/src/integration-test/java/sample/ApplicationTests.java index ddd338c3..08afdb6b 100644 --- a/samples/boot/websocket/src/integration-test/java/sample/ApplicationTests.java +++ b/samples/boot/websocket/src/integration-test/java/sample/ApplicationTests.java @@ -20,8 +20,8 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.GenericContainer; import org.springframework.beans.factory.annotation.Autowired; @@ -31,7 +31,7 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.util.concurrent.ListenableFuture; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketHandler; @@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Rob Winch * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class ApplicationTests { diff --git a/samples/javaconfig/custom-cookie/spring-session-sample-javaconfig-custom-cookie.gradle b/samples/javaconfig/custom-cookie/spring-session-sample-javaconfig-custom-cookie.gradle index 7e38f8af..ef0eaf1c 100644 --- a/samples/javaconfig/custom-cookie/spring-session-sample-javaconfig-custom-cookie.gradle +++ b/samples/javaconfig/custom-cookie/spring-session-sample-javaconfig-custom-cookie.gradle @@ -12,8 +12,9 @@ dependencies { providedCompile "javax.servlet:javax.servlet-api" - testCompile "junit:junit" testCompile "org.assertj:assertj-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies } diff --git a/samples/javaconfig/custom-cookie/src/integration-test/java/sample/AttributeTests.java b/samples/javaconfig/custom-cookie/src/integration-test/java/sample/AttributeTests.java index 59bee8f3..a93598b5 100644 --- a/samples/javaconfig/custom-cookie/src/integration-test/java/sample/AttributeTests.java +++ b/samples/javaconfig/custom-cookie/src/integration-test/java/sample/AttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package sample; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import sample.pages.HomePage; @@ -36,12 +36,12 @@ public class AttributeTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = new HtmlUnitDriver(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/javaconfig/hazelcast/spring-session-sample-javaconfig-hazelcast.gradle b/samples/javaconfig/hazelcast/spring-session-sample-javaconfig-hazelcast.gradle index 58aab6d2..829037d4 100644 --- a/samples/javaconfig/hazelcast/spring-session-sample-javaconfig-hazelcast.gradle +++ b/samples/javaconfig/hazelcast/spring-session-sample-javaconfig-hazelcast.gradle @@ -14,8 +14,9 @@ dependencies { providedCompile "javax.servlet:javax.servlet-api" providedCompile "javax.servlet.jsp:javax.servlet.jsp-api" - testCompile "junit:junit" testCompile "org.assertj:assertj-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies } diff --git a/samples/javaconfig/hazelcast/src/integration-test/java/sample/HazelcastSpringTests.java b/samples/javaconfig/hazelcast/src/integration-test/java/sample/HazelcastSpringTests.java index 90358108..effcbe4c 100644 --- a/samples/javaconfig/hazelcast/src/integration-test/java/sample/HazelcastSpringTests.java +++ b/samples/javaconfig/hazelcast/src/integration-test/java/sample/HazelcastSpringTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,9 @@ package sample; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import sample.pages.HomePage; @@ -32,12 +32,12 @@ public class HazelcastSpringTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = new HtmlUnitDriver(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/javaconfig/jdbc/spring-session-sample-javaconfig-jdbc.gradle b/samples/javaconfig/jdbc/spring-session-sample-javaconfig-jdbc.gradle index 326e690b..93e6ca0a 100644 --- a/samples/javaconfig/jdbc/spring-session-sample-javaconfig-jdbc.gradle +++ b/samples/javaconfig/jdbc/spring-session-sample-javaconfig-jdbc.gradle @@ -11,8 +11,9 @@ dependencies { providedCompile "javax.servlet:javax.servlet-api" - testCompile "junit:junit" testCompile "org.assertj:assertj-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies } diff --git a/samples/javaconfig/jdbc/src/integration-test/java/sample/AttributeTests.java b/samples/javaconfig/jdbc/src/integration-test/java/sample/AttributeTests.java index 59bee8f3..a93598b5 100644 --- a/samples/javaconfig/jdbc/src/integration-test/java/sample/AttributeTests.java +++ b/samples/javaconfig/jdbc/src/integration-test/java/sample/AttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package sample; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import sample.pages.HomePage; @@ -36,12 +36,12 @@ public class AttributeTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = new HtmlUnitDriver(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/javaconfig/redis/spring-session-sample-javaconfig-redis.gradle b/samples/javaconfig/redis/spring-session-sample-javaconfig-redis.gradle index 7e38f8af..ef0eaf1c 100644 --- a/samples/javaconfig/redis/spring-session-sample-javaconfig-redis.gradle +++ b/samples/javaconfig/redis/spring-session-sample-javaconfig-redis.gradle @@ -12,8 +12,9 @@ dependencies { providedCompile "javax.servlet:javax.servlet-api" - testCompile "junit:junit" testCompile "org.assertj:assertj-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies } diff --git a/samples/javaconfig/redis/src/integration-test/java/sample/AttributeTests.java b/samples/javaconfig/redis/src/integration-test/java/sample/AttributeTests.java index 59bee8f3..a93598b5 100644 --- a/samples/javaconfig/redis/src/integration-test/java/sample/AttributeTests.java +++ b/samples/javaconfig/redis/src/integration-test/java/sample/AttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package sample; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import sample.pages.HomePage; @@ -36,12 +36,12 @@ public class AttributeTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = new HtmlUnitDriver(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/javaconfig/rest/spring-session-sample-javaconfig-rest.gradle b/samples/javaconfig/rest/spring-session-sample-javaconfig-rest.gradle index 65be98eb..a84907f0 100644 --- a/samples/javaconfig/rest/spring-session-sample-javaconfig-rest.gradle +++ b/samples/javaconfig/rest/spring-session-sample-javaconfig-rest.gradle @@ -13,10 +13,11 @@ dependencies { providedCompile "javax.servlet:javax.servlet-api" - testCompile "junit:junit" testCompile "org.springframework.security:spring-security-test" testCompile "org.assertj:assertj-core" testCompile "org.springframework:spring-test" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" } gretty { diff --git a/samples/javaconfig/rest/src/integration-test/java/rest/RestMockMvcTests.java b/samples/javaconfig/rest/src/integration-test/java/rest/RestMockMvcTests.java index e0b6a232..9bffa200 100644 --- a/samples/javaconfig/rest/src/integration-test/java/rest/RestMockMvcTests.java +++ b/samples/javaconfig/rest/src/integration-test/java/rest/RestMockMvcTests.java @@ -16,9 +16,9 @@ package rest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.GenericContainer; import sample.SecurityConfig; import sample.mvc.MvcConfig; @@ -34,7 +34,7 @@ import org.springframework.session.web.http.HeaderHttpSessionIdResolver; import org.springframework.session.web.http.HttpSessionIdResolver; import org.springframework.session.web.http.SessionRepositoryFilter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = { RestMockMvcTests.Config.class, SecurityConfig.class, MvcConfig.class }) @WebAppConfiguration @@ -64,7 +64,7 @@ public class RestMockMvcTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).alwaysDo(print()) .addFilters(this.sessionRepositoryFilter).apply(springSecurity()).build(); diff --git a/samples/javaconfig/rest/src/integration-test/java/sample/RestTests.java b/samples/javaconfig/rest/src/integration-test/java/sample/RestTests.java index 7941f7a8..36a331d2 100644 --- a/samples/javaconfig/rest/src/integration-test/java/sample/RestTests.java +++ b/samples/javaconfig/rest/src/integration-test/java/sample/RestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ package sample; import java.util.Arrays; import java.util.Base64; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -47,7 +47,7 @@ public class RestTests { private String baseUrl; - @Before + @BeforeEach public void setUp() { this.baseUrl = "http://localhost:" + System.getProperty("app.port"); this.restTemplate = new RestTemplate(); diff --git a/samples/javaconfig/security/spring-session-sample-javaconfig-security.gradle b/samples/javaconfig/security/spring-session-sample-javaconfig-security.gradle index fa4e092a..46c3e452 100644 --- a/samples/javaconfig/security/spring-session-sample-javaconfig-security.gradle +++ b/samples/javaconfig/security/spring-session-sample-javaconfig-security.gradle @@ -15,9 +15,10 @@ dependencies { providedCompile "javax.servlet:javax.servlet-api" providedCompile "javax.servlet.jsp:javax.servlet.jsp-api" - testCompile "junit:junit" testCompile "org.assertj:assertj-core" testCompile "org.springframework:spring-test" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies } diff --git a/samples/javaconfig/security/src/integration-test/java/sample/SecurityTests.java b/samples/javaconfig/security/src/integration-test/java/sample/SecurityTests.java index 5924803e..e9a00777 100644 --- a/samples/javaconfig/security/src/integration-test/java/sample/SecurityTests.java +++ b/samples/javaconfig/security/src/integration-test/java/sample/SecurityTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package sample; import java.util.Set; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openqa.selenium.By; import org.openqa.selenium.Cookie; import org.openqa.selenium.WebDriver; @@ -39,12 +39,12 @@ public class SecurityTests { private WebDriver driver; - @Before + @BeforeEach public void setUp() { this.driver = new HtmlUnitDriver(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/misc/hazelcast/spring-session-sample-misc-hazelcast.gradle b/samples/misc/hazelcast/spring-session-sample-misc-hazelcast.gradle index 07f2c1f5..91934f63 100644 --- a/samples/misc/hazelcast/spring-session-sample-misc-hazelcast.gradle +++ b/samples/misc/hazelcast/spring-session-sample-misc-hazelcast.gradle @@ -10,8 +10,9 @@ dependencies { providedCompile "javax.servlet:javax.servlet-api" - testCompile "junit:junit" testCompile "org.assertj:assertj-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies } diff --git a/samples/misc/hazelcast/src/integration-test/java/sample/AttributeTests.java b/samples/misc/hazelcast/src/integration-test/java/sample/AttributeTests.java index 309ceca9..1518cdc0 100644 --- a/samples/misc/hazelcast/src/integration-test/java/sample/AttributeTests.java +++ b/samples/misc/hazelcast/src/integration-test/java/sample/AttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package sample; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import sample.pages.HomePage; @@ -36,12 +36,12 @@ public class AttributeTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = new HtmlUnitDriver(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/xml/jdbc/spring-session-sample-xml-jdbc.gradle b/samples/xml/jdbc/spring-session-sample-xml-jdbc.gradle index c2968256..cd10aa7f 100644 --- a/samples/xml/jdbc/spring-session-sample-xml-jdbc.gradle +++ b/samples/xml/jdbc/spring-session-sample-xml-jdbc.gradle @@ -11,8 +11,9 @@ dependencies { providedCompile "javax.servlet:javax.servlet-api" - testCompile "junit:junit" testCompile "org.assertj:assertj-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies } diff --git a/samples/xml/jdbc/src/integration-test/java/sample/AttributeTests.java b/samples/xml/jdbc/src/integration-test/java/sample/AttributeTests.java index 59bee8f3..a93598b5 100644 --- a/samples/xml/jdbc/src/integration-test/java/sample/AttributeTests.java +++ b/samples/xml/jdbc/src/integration-test/java/sample/AttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package sample; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import sample.pages.HomePage; @@ -36,12 +36,12 @@ public class AttributeTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = new HtmlUnitDriver(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/samples/xml/redis/spring-session-sample-xml-redis.gradle b/samples/xml/redis/spring-session-sample-xml-redis.gradle index 7e38f8af..8648ee5b 100644 --- a/samples/xml/redis/spring-session-sample-xml-redis.gradle +++ b/samples/xml/redis/spring-session-sample-xml-redis.gradle @@ -12,8 +12,9 @@ dependencies { providedCompile "javax.servlet:javax.servlet-api" - testCompile "junit:junit" testCompile "org.assertj:assertj-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile seleniumDependencies } diff --git a/samples/xml/redis/src/integration-test/java/sample/AttributeTests.java b/samples/xml/redis/src/integration-test/java/sample/AttributeTests.java index eea98df4..a93c0ec4 100644 --- a/samples/xml/redis/src/integration-test/java/sample/AttributeTests.java +++ b/samples/xml/redis/src/integration-test/java/sample/AttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package sample; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import sample.pages.HomePage; @@ -36,12 +36,12 @@ public class AttributeTests { private WebDriver driver; - @Before + @BeforeEach public void setup() { this.driver = new HtmlUnitDriver(); } - @After + @AfterEach public void tearDown() { this.driver.quit(); } diff --git a/spring-session-core/spring-session-core.gradle b/spring-session-core/spring-session-core.gradle index 7fe01822..0b5967a2 100644 --- a/spring-session-core/spring-session-core.gradle +++ b/spring-session-core/spring-session-core.gradle @@ -18,10 +18,12 @@ dependencies { optional "org.springframework.security:spring-security-web" testCompile "io.projectreactor:reactor-test" - testCompile "junit:junit" testCompile "org.mockito:mockito-core" testCompile "edu.umd.cs.mtc:multithreadedtc" testCompile "org.springframework:spring-test" testCompile "org.assertj:assertj-core" testCompile "org.springframework.security:spring-security-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testCompile "org.junit.jupiter:junit-jupiter-params" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" } diff --git a/spring-session-core/src/test/java/org/springframework/session/MapSessionRepositoryTests.java b/spring-session-core/src/test/java/org/springframework/session/MapSessionRepositoryTests.java index 0527ddb5..2a1cc612 100644 --- a/spring-session-core/src/test/java/org/springframework/session/MapSessionRepositoryTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/MapSessionRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,8 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.concurrent.ConcurrentHashMap; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -35,7 +35,7 @@ public class MapSessionRepositoryTests { private MapSession session; - @Before + @BeforeEach public void setup() { this.repository = new MapSessionRepository(new ConcurrentHashMap<>()); this.session = new MapSession(); diff --git a/spring-session-core/src/test/java/org/springframework/session/MapSessionTests.java b/spring-session-core/src/test/java/org/springframework/session/MapSessionTests.java index b2aee29b..52fd97ee 100644 --- a/spring-session-core/src/test/java/org/springframework/session/MapSessionTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/MapSessionTests.java @@ -20,8 +20,8 @@ import java.time.Duration; import java.time.Instant; import java.util.Set; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -30,7 +30,7 @@ public class MapSessionTests { private MapSession session; - @Before + @BeforeEach public void setup() { this.session = new MapSession(); this.session.setLastAccessedTime(Instant.ofEpochMilli(1413258262962L)); diff --git a/spring-session-core/src/test/java/org/springframework/session/ReactiveMapSessionRepositoryTests.java b/spring-session-core/src/test/java/org/springframework/session/ReactiveMapSessionRepositoryTests.java index b542546b..c2362a82 100644 --- a/spring-session-core/src/test/java/org/springframework/session/ReactiveMapSessionRepositoryTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/ReactiveMapSessionRepositoryTests.java @@ -23,8 +23,8 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -41,7 +41,7 @@ public class ReactiveMapSessionRepositoryTests { private MapSession session; - @Before + @BeforeEach public void setup() { this.repository = new ReactiveMapSessionRepository(new HashMap<>()); this.session = new MapSession("session-id"); diff --git a/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java b/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java index aa673527..13e9cb24 100644 --- a/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,9 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -41,7 +41,7 @@ import org.springframework.session.web.http.CookieSerializer; import org.springframework.session.web.http.CookieSerializer.CookieValue; import org.springframework.session.web.http.SessionRepositoryFilter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -58,7 +58,7 @@ import static org.mockito.Mockito.verify; * * @author Rob Winch */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class EnableSpringHttpSessionCustomCookieSerializerTests { @@ -80,7 +80,7 @@ public class EnableSpringHttpSessionCustomCookieSerializerTests { @Autowired private CookieSerializer cookieSerializer; - @Before + @BeforeEach public void setup() { this.chain = new MockFilterChain(); diff --git a/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfigurationTests.java b/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfigurationTests.java index f8b89109..074daf72 100644 --- a/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfigurationTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ import java.util.concurrent.ConcurrentHashMap; import javax.servlet.ServletContext; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.UnsatisfiedDependencyException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -49,7 +49,7 @@ public class SpringHttpSessionConfigurationTests { private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - @After + @AfterEach public void closeContext() { if (this.context != null) { this.context.close(); diff --git a/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/server/SpringWebSessionConfigurationTests.java b/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/server/SpringWebSessionConfigurationTests.java index 59a962b6..f2245f71 100644 --- a/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/server/SpringWebSessionConfigurationTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/config/annotation/web/server/SpringWebSessionConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package org.springframework.session.config.annotation.web.server; import java.util.HashMap; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.UnsatisfiedDependencyException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; public class SpringWebSessionConfigurationTests { private AnnotationConfigApplicationContext context; - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/spring-session-core/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java b/spring-session-core/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java index dab359b7..0fcb6960 100644 --- a/spring-session-core/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java +++ b/spring-session-core/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,12 +23,12 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextImpl; @@ -46,7 +46,6 @@ import static org.mockito.BDDMockito.when; /** * Tests for {@link SpringSessionBackedSessionRegistry}. */ -@RunWith(MockitoJUnitRunner.class) public class SpringSessionBackedSessionRegistryTest { private static final String SESSION_ID = "sessionId"; @@ -66,6 +65,11 @@ public class SpringSessionBackedSessionRegistryTest { @InjectMocks private SpringSessionBackedSessionRegistry sessionRegistry; + @BeforeEach + void setUp() { + MockitoAnnotations.initMocks(this); + } + @Test public void sessionInformationForExistingSession() { Session session = createSession(SESSION_ID, USER_NAME, NOW); diff --git a/spring-session-core/src/test/java/org/springframework/session/security/web/authentication/SpringSessionRememberMeServicesTests.java b/spring-session-core/src/test/java/org/springframework/session/security/web/authentication/SpringSessionRememberMeServicesTests.java index 8b480828..3b6671e9 100644 --- a/spring-session-core/src/test/java/org/springframework/session/security/web/authentication/SpringSessionRememberMeServicesTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/security/web/authentication/SpringSessionRememberMeServicesTests.java @@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.Authentication; import org.springframework.security.web.context.HttpSessionSecurityContextRepository; diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/CookieHttpSessionIdResolverTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/CookieHttpSessionIdResolverTests.java index 57be473b..c10e00a5 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/http/CookieHttpSessionIdResolverTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/http/CookieHttpSessionIdResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,8 @@ import java.util.Collections; import javax.servlet.http.Cookie; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -43,7 +43,7 @@ public class CookieHttpSessionIdResolverTests { private String cookieName; private Session session; - @Before + @BeforeEach public void setup() throws Exception { this.cookieName = "SESSION"; this.session = new MapSession(); diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/DefaultCookieSerializerTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/DefaultCookieSerializerTests.java index 4eac9dab..246edaa6 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/http/DefaultCookieSerializerTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/http/DefaultCookieSerializerTests.java @@ -20,11 +20,10 @@ import java.util.Base64; import javax.servlet.http.Cookie; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.springframework.mock.web.MockCookie; import org.springframework.mock.web.MockHttpServletRequest; @@ -43,16 +42,8 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; * @author Vedran Pavic * @author Eddú Meléndez */ -@RunWith(Parameterized.class) public class DefaultCookieSerializerTests { - @Parameters(name = "useBase64Encoding={0}") - public static Object[] parameters() { - return new Object[] { false, true }; - } - - private boolean useBase64Encoding; - private String cookieName; private MockHttpServletRequest request; @@ -63,18 +54,13 @@ public class DefaultCookieSerializerTests { private String sessionId; - public DefaultCookieSerializerTests(boolean useBase64Encoding) { - this.useBase64Encoding = useBase64Encoding; - } - - @Before + @BeforeEach public void setup() { this.cookieName = "SESSION"; this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); this.sessionId = "sessionId"; this.serializer = new DefaultCookieSerializer(); - this.serializer.setUseBase64Encoding(this.useBase64Encoding); } // --- readCookieValues --- @@ -84,9 +70,12 @@ public class DefaultCookieSerializerTests { assertThat(this.serializer.readCookieValues(this.request)).isEmpty(); } - @Test - public void readCookieValuesSingle() { - this.request.setCookies(createCookie(this.cookieName, this.sessionId)); + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieValuesSingle(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); + this.request.setCookies( + createCookie(this.cookieName, this.sessionId, useBase64Encoding)); assertThat(this.serializer.readCookieValues(this.request)) .containsOnly(this.sessionId); @@ -101,57 +90,72 @@ public class DefaultCookieSerializerTests { assertThat(this.serializer.readCookieValues(this.request)).isEmpty(); } - @Test - public void readCookieValuesSingleAndInvalidName() { - this.request.setCookies(createCookie(this.cookieName, this.sessionId), - createCookie(this.cookieName + "INVALID", this.sessionId + "INVALID")); + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieValuesSingleAndInvalidName(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); + this.request.setCookies( + createCookie(this.cookieName, this.sessionId, useBase64Encoding), + createCookie(this.cookieName + "INVALID", this.sessionId + "INVALID", + useBase64Encoding)); assertThat(this.serializer.readCookieValues(this.request)) .containsOnly(this.sessionId); } - @Test - public void readCookieValuesMulti() { + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieValuesMulti(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); String secondSession = "secondSessionId"; - this.request.setCookies(createCookie(this.cookieName, this.sessionId), - createCookie(this.cookieName, secondSession)); + this.request.setCookies( + createCookie(this.cookieName, this.sessionId, useBase64Encoding), + createCookie(this.cookieName, secondSession, useBase64Encoding)); assertThat(this.serializer.readCookieValues(this.request)) .containsExactly(this.sessionId, secondSession); } - @Test - public void readCookieValuesMultiCustomSessionCookieName() { + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieValuesMultiCustomSessionCookieName(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); setCookieName("JSESSIONID"); String secondSession = "secondSessionId"; - this.request.setCookies(createCookie(this.cookieName, this.sessionId), - createCookie(this.cookieName, secondSession)); + this.request.setCookies( + createCookie(this.cookieName, this.sessionId, useBase64Encoding), + createCookie(this.cookieName, secondSession, useBase64Encoding)); assertThat(this.serializer.readCookieValues(this.request)) .containsExactly(this.sessionId, secondSession); } // gh-392 - @Test - public void readCookieValuesNullCookieValue() { - this.request.setCookies(createCookie(this.cookieName, null)); + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieValuesNullCookieValue(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); + this.request.setCookies(createCookie(this.cookieName, null, useBase64Encoding)); assertThat(this.serializer.readCookieValues(this.request)).isEmpty(); } - @Test - public void readCookieValuesNullCookieValueAndJvmRoute() { + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieValuesNullCookieValueAndJvmRoute(boolean useBase64Encoding) { this.serializer.setJvmRoute("123"); - this.request.setCookies(createCookie(this.cookieName, null)); + this.request.setCookies(createCookie(this.cookieName, null, useBase64Encoding)); assertThat(this.serializer.readCookieValues(this.request)).isEmpty(); } - @Test - public void readCookieValuesNullCookieValueAndNotNullCookie() { + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieValuesNullCookieValueAndNotNullCookie(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); this.serializer.setJvmRoute("123"); - this.request.setCookies(createCookie(this.cookieName, null), - createCookie(this.cookieName, this.sessionId)); + this.request.setCookies(createCookie(this.cookieName, null, useBase64Encoding), + createCookie(this.cookieName, this.sessionId, useBase64Encoding)); assertThat(this.serializer.readCookieValues(this.request)) .containsOnly(this.sessionId); @@ -159,11 +163,13 @@ public class DefaultCookieSerializerTests { // --- writeCookie --- - @Test - public void writeCookie() { + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void writeCookie(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); this.serializer.writeCookieValue(cookieValue(this.sessionId)); - assertThat(getCookieValue()).isEqualTo(this.sessionId); + assertThat(getCookieValue(useBase64Encoding)).isEqualTo(this.sessionId); } // --- httpOnly --- @@ -406,42 +412,53 @@ public class DefaultCookieSerializerTests { // --- jvmRoute --- - @Test - public void writeCookieJvmRoute() { + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void writeCookieJvmRoute(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); String jvmRoute = "route"; this.serializer.setJvmRoute(jvmRoute); this.serializer.writeCookieValue(cookieValue(this.sessionId)); - assertThat(getCookieValue()).isEqualTo(this.sessionId + "." + jvmRoute); + assertThat(getCookieValue(useBase64Encoding)) + .isEqualTo(this.sessionId + "." + jvmRoute); } - @Test - public void readCookieJvmRoute() { + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieJvmRoute(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); + String jvmRoute = "route"; + this.serializer.setJvmRoute(jvmRoute); + this.request.setCookies(createCookie(this.cookieName, + this.sessionId + "." + jvmRoute, useBase64Encoding)); + + assertThat(this.serializer.readCookieValues(this.request)) + .containsOnly(this.sessionId); + } + + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieJvmRouteRouteMissing(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); String jvmRoute = "route"; this.serializer.setJvmRoute(jvmRoute); this.request.setCookies( - createCookie(this.cookieName, this.sessionId + "." + jvmRoute)); + createCookie(this.cookieName, this.sessionId, useBase64Encoding)); assertThat(this.serializer.readCookieValues(this.request)) .containsOnly(this.sessionId); } - @Test - public void readCookieJvmRouteRouteMissing() { + @ParameterizedTest + @ValueSource(strings = { "true", "false" }) + public void readCookieJvmRouteOnlyRoute(boolean useBase64Encoding) { + this.serializer.setUseBase64Encoding(useBase64Encoding); String jvmRoute = "route"; this.serializer.setJvmRoute(jvmRoute); - this.request.setCookies(createCookie(this.cookieName, this.sessionId)); - - assertThat(this.serializer.readCookieValues(this.request)) - .containsOnly(this.sessionId); - } - - @Test - public void readCookieJvmRouteOnlyRoute() { - String jvmRoute = "route"; - this.serializer.setJvmRoute(jvmRoute); - this.request.setCookies(createCookie(this.cookieName, "." + jvmRoute)); + this.request.setCookies( + createCookie(this.cookieName, "." + jvmRoute, useBase64Encoding)); assertThat(this.serializer.readCookieValues(this.request)).containsOnly(""); } @@ -506,8 +523,8 @@ public class DefaultCookieSerializerTests { this.serializer.setCookieName(cookieName); } - private Cookie createCookie(String name, String value) { - if (this.useBase64Encoding && StringUtils.hasLength(value)) { + private Cookie createCookie(String name, String value, boolean useBase64Encoding) { + if (useBase64Encoding && StringUtils.hasLength(value)) { value = new String(Base64.getEncoder().encode(value.getBytes())); } return new Cookie(name, value); @@ -517,9 +534,9 @@ public class DefaultCookieSerializerTests { return (MockCookie) this.response.getCookie(this.cookieName); } - private String getCookieValue() { + private String getCookieValue(boolean useBase64Encoding) { String value = getCookie().getValue(); - if (!this.useBase64Encoding) { + if (!useBase64Encoding) { return value; } if (value == null) { diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/HeaderHttpSessionIdResolverTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/HeaderHttpSessionIdResolverTests.java index 01114b16..4c911359 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/http/HeaderHttpSessionIdResolverTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/http/HeaderHttpSessionIdResolverTests.java @@ -19,8 +19,8 @@ package org.springframework.session.web.http; import java.util.Collections; import java.util.UUID; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -42,7 +42,7 @@ public class HeaderHttpSessionIdResolverTests { private HeaderHttpSessionIdResolver resolver; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/OnCommittedResponseWrapperTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/OnCommittedResponseWrapperTests.java index 716b3ab2..74ffe250 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/http/OnCommittedResponseWrapperTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/http/OnCommittedResponseWrapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,17 +23,15 @@ import java.util.Locale; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) public class OnCommittedResponseWrapperTests { private static final String NL = "\r\n"; @@ -48,8 +46,9 @@ public class OnCommittedResponseWrapperTests { boolean committed; - @Before + @BeforeEach public void setup() throws Exception { + MockitoAnnotations.initMocks(this); this.response = new OnCommittedResponseWrapper(this.delegate) { @Override protected void onResponseCommitted() { diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/OncePerRequestFilterTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/OncePerRequestFilterTests.java index 52b200d2..791cd10d 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/http/OncePerRequestFilterTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/http/OncePerRequestFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,8 +26,8 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; @@ -44,7 +44,7 @@ public class OncePerRequestFilterTests { private List invocations; - @Before + @BeforeEach @SuppressWarnings("serial") public void setup() { this.servlet = new HttpServlet() { diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/SessionEventHttpSessionListenerAdapterTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/SessionEventHttpSessionListenerAdapterTests.java index 65c7668f..39b648c3 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/http/SessionEventHttpSessionListenerAdapterTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/http/SessionEventHttpSessionListenerAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,13 +23,12 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.mock.web.MockServletContext; import org.springframework.session.MapSession; @@ -48,7 +47,6 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @since 1.1 */ -@RunWith(MockitoJUnitRunner.class) public class SessionEventHttpSessionListenerAdapterTests { @Mock @@ -69,8 +67,9 @@ public class SessionEventHttpSessionListenerAdapterTests { private SessionEventHttpSessionListenerAdapter listener; - @Before + @BeforeEach public void setup() { + MockitoAnnotations.initMocks(this); this.listener = new SessionEventHttpSessionListenerAdapter( Arrays.asList(this.listener1, this.listener2)); this.listener.setServletContext(new MockServletContext()); diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java index 0b40dbde..f891f886 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java @@ -43,11 +43,10 @@ import javax.servlet.http.HttpSessionBindingListener; import javax.servlet.http.HttpSessionContext; import org.assertj.core.data.Offset; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.core.Ordered; import org.springframework.core.annotation.AnnotationAwareOrderComparator; @@ -78,7 +77,6 @@ import static org.mockito.Mockito.verifyZeroInteractions; /** * Tests for {@link SessionRepositoryFilter}. */ -@RunWith(MockitoJUnitRunner.class) @SuppressWarnings("deprecation") public class SessionRepositoryFilterTests { @@ -97,8 +95,9 @@ public class SessionRepositoryFilterTests { private MockFilterChain chain; - @Before + @BeforeEach public void setup() throws Exception { + MockitoAnnotations.initMocks(this); this.sessions = new HashMap<>(); this.sessionRepository = new MapSessionRepository(this.sessions); this.filter = new SessionRepositoryFilter<>(this.sessionRepository); diff --git a/spring-session-core/src/test/java/org/springframework/session/web/server/session/SpringSessionWebSessionStoreTests.java b/spring-session-core/src/test/java/org/springframework/session/web/server/session/SpringSessionWebSessionStoreTests.java index c39bc420..a8aa5876 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/server/session/SpringSessionWebSessionStoreTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/server/session/SpringSessionWebSessionStoreTests.java @@ -21,11 +21,10 @@ import java.util.Collections; import java.util.Map; import java.util.Set; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import reactor.core.publisher.Mono; import org.springframework.session.ReactiveSessionRepository; @@ -44,7 +43,6 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @author Vedran Pavic */ -@RunWith(MockitoJUnitRunner.class) public class SpringSessionWebSessionStoreTests { @Mock @@ -58,8 +56,9 @@ public class SpringSessionWebSessionStoreTests { private SpringSessionWebSessionStore webSessionStore; - @Before + @BeforeEach public void setup() { + MockitoAnnotations.initMocks(this); this.webSessionStore = new SpringSessionWebSessionStore<>(this.sessionRepository); given(this.sessionRepository.findById(any())) .willReturn(Mono.just(this.findByIdSession)); diff --git a/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketConnectHandlerDecoratorFactoryTests.java b/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketConnectHandlerDecoratorFactoryTests.java index 1243cc14..9cac3728 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketConnectHandlerDecoratorFactoryTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketConnectHandlerDecoratorFactoryTests.java @@ -16,13 +16,12 @@ package org.springframework.session.web.socket.handler; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationEventPublisher; @@ -36,7 +35,6 @@ import static org.mockito.BDDMockito.willThrow; import static org.mockito.Mockito.any; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) public class WebSocketConnectHandlerDecoratorFactoryTests { @Mock ApplicationEventPublisher eventPublisher; @@ -49,8 +47,9 @@ public class WebSocketConnectHandlerDecoratorFactoryTests { WebSocketConnectHandlerDecoratorFactory factory; - @Before + @BeforeEach public void setup() { + MockitoAnnotations.initMocks(this); this.factory = new WebSocketConnectHandlerDecoratorFactory(this.eventPublisher); } diff --git a/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketRegistryListenerTests.java b/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketRegistryListenerTests.java index e3b20139..8d0a8d5a 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketRegistryListenerTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketRegistryListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,10 @@ import java.security.Principal; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; @@ -45,7 +44,6 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) public class WebSocketRegistryListenerTests { @Mock @@ -74,8 +72,9 @@ public class WebSocketRegistryListenerTests { private WebSocketRegistryListener listener; - @Before + @BeforeEach public void setup() { + MockitoAnnotations.initMocks(this); String sessionId = "session-id"; MapSession session = new MapSession(sessionId); diff --git a/spring-session-core/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java b/spring-session-core/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java index dd6ddbbc..70b14d8b 100644 --- a/spring-session-core/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java +++ b/spring-session-core/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java @@ -25,12 +25,11 @@ import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpSession; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatcher; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.http.server.ServletServerHttpRequest; import org.springframework.messaging.Message; @@ -52,7 +51,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; -@RunWith(MockitoJUnitRunner.class) public class SessionRepositoryMessageInterceptorTests { @Mock SessionRepository sessionRepository; @@ -67,8 +65,9 @@ public class SessionRepositoryMessageInterceptorTests { SessionRepositoryMessageInterceptor interceptor; - @Before + @BeforeEach public void setup() { + MockitoAnnotations.initMocks(this); this.interceptor = new SessionRepositoryMessageInterceptor<>( this.sessionRepository); this.headers = SimpMessageHeaderAccessor.create(); diff --git a/spring-session-data-redis/spring-session-data-redis.gradle b/spring-session-data-redis/spring-session-data-redis.gradle index c93ced86..e6bae874 100644 --- a/spring-session-data-redis/spring-session-data-redis.gradle +++ b/spring-session-data-redis/spring-session-data-redis.gradle @@ -16,6 +16,8 @@ dependencies { testCompile "javax.servlet:javax.servlet-api" testCompile "org.springframework:spring-web" testCompile "org.springframework.security:spring-security-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile "io.lettuce:lettuce-core" integrationTestCompile "org.testcontainers:testcontainers" diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryITests.java index c439740f..2015ca18 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryITests.java @@ -18,8 +18,8 @@ package org.springframework.session.data.redis; import java.time.Instant; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; @@ -27,7 +27,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.session.Session; import org.springframework.session.data.redis.config.annotation.web.server.EnableRedisWebSession; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests { diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryITests.java index de053854..3b05d485 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryITests.java @@ -20,9 +20,9 @@ import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.UUID; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -43,12 +43,12 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR import org.springframework.session.events.SessionCreatedEvent; import org.springframework.session.events.SessionDestroyedEvent; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class RedisOperationsSessionRepositoryITests extends AbstractRedisITests { @@ -70,7 +70,7 @@ public class RedisOperationsSessionRepositoryITests extends AbstractRedisITests private SecurityContext changedContext; - @Before + @BeforeEach public void setup() { if (this.registry != null) { this.registry.clear(); diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSessionExpireSessionDestroyedTests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSessionExpireSessionDestroyedTests.java index ef8f802b..45efcbaa 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSessionExpireSessionDestroyedTests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSessionExpireSessionDestroyedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package org.springframework.session.data.redis.config.annotation.web.http; import java.util.concurrent.TimeUnit; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; @@ -36,12 +36,12 @@ import org.springframework.session.SessionRepository; import org.springframework.session.data.redis.AbstractRedisITests; import org.springframework.session.events.SessionExpiredEvent; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class EnableRedisHttpSessionExpireSessionDestroyedTests @@ -55,7 +55,7 @@ public class EnableRedisHttpSessionExpireSessionDestroyedTests diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/taskexecutor/RedisListenerContainerTaskExecutorITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/taskexecutor/RedisListenerContainerTaskExecutorITests.java index d3b951bd..8b180b6c 100644 --- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/taskexecutor/RedisListenerContainerTaskExecutorITests.java +++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/taskexecutor/RedisListenerContainerTaskExecutorITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -34,7 +34,7 @@ import org.springframework.session.data.redis.AbstractRedisITests; import org.springframework.session.data.redis.config.annotation.SpringSessionRedisOperations; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; /** * @author Vladimir Tsanev */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class RedisListenerContainerTaskExecutorITests extends AbstractRedisITests { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java index ad43eb83..ab884701 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java @@ -22,8 +22,8 @@ import java.time.temporal.ChronoUnit; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -67,7 +67,7 @@ public class ReactiveRedisOperationsSessionRepositoryTests { private MapSession cached; - @Before + @BeforeEach public void setUp() { this.repository = new ReactiveRedisOperationsSessionRepository( this.redisOperations); diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java index bec69ea0..43b584fa 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java @@ -28,13 +28,12 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.context.ApplicationEventPublisher; import org.springframework.data.redis.connection.DefaultMessage; @@ -72,7 +71,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; -@RunWith(MockitoJUnitRunner.class) @SuppressWarnings({ "unchecked", "rawtypes" }) public class RedisOperationsSessionRepositoryTests { static final String SPRING_SECURITY_CONTEXT_KEY = "SPRING_SECURITY_CONTEXT"; @@ -102,8 +100,9 @@ public class RedisOperationsSessionRepositoryTests { private RedisOperationsSessionRepository redisRepository; - @Before + @BeforeEach public void setup() { + MockitoAnnotations.initMocks(this); this.redisRepository = new RedisOperationsSessionRepository(this.redisOperations); this.redisRepository.setDefaultSerializer(this.defaultSerializer); diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisSessionExpirationPolicyTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisSessionExpirationPolicyTests.java index c8ae7a98..0b924f70 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisSessionExpirationPolicyTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisSessionExpirationPolicyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,10 @@ import java.time.Duration; import java.time.Instant; import java.util.concurrent.TimeUnit; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.data.redis.core.BoundHashOperations; import org.springframework.data.redis.core.BoundSetOperations; @@ -40,7 +39,6 @@ import static org.mockito.Mockito.verify; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) public class RedisSessionExpirationPolicyTests { // Wed Apr 15 10:28:32 CDT 2015 static final Long NOW = 1429111712346L; @@ -61,8 +59,9 @@ public class RedisSessionExpirationPolicyTests { private MapSession session; - @Before + @BeforeEach public void setup() { + MockitoAnnotations.initMocks(this); RedisOperationsSessionRepository repository = new RedisOperationsSessionRepository( this.sessionRedisOperations); this.policy = new RedisSessionExpirationPolicy(this.sessionRedisOperations, diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisKeyspaceNotificationsInitializerTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisKeyspaceNotificationsInitializerTests.java index 1978a41b..35d3e614 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisKeyspaceNotificationsInitializerTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisKeyspaceNotificationsInitializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,12 @@ package org.springframework.session.data.redis.config.annotation.web.http; import java.util.Properties; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; @@ -37,7 +36,6 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) public class EnableRedisKeyspaceNotificationsInitializerTests { static final String CONFIG_NOTIFY_KEYSPACE_EVENTS = "notify-keyspace-events"; @@ -50,8 +48,9 @@ public class EnableRedisKeyspaceNotificationsInitializerTests { RedisHttpSessionConfiguration.EnableRedisKeyspaceNotificationsInitializer initializer; - @Before + @BeforeEach public void setup() { + MockitoAnnotations.initMocks(this); given(this.connectionFactory.getConnection()).willReturn(this.connection); this.initializer = new RedisHttpSessionConfiguration.EnableRedisKeyspaceNotificationsInitializer( diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationClassPathXmlApplicationContextTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationClassPathXmlApplicationContextTests.java index 140f0b12..1985764c 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationClassPathXmlApplicationContextTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationClassPathXmlApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,13 @@ package org.springframework.session.data.redis.config.annotation.web.http; import java.util.Properties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.BDDMockito.given; @@ -35,7 +35,7 @@ import static org.mockito.Mockito.mock; * @author Mark Paluch * */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration public class RedisHttpSessionConfigurationClassPathXmlApplicationContextTests { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationMockTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationMockTests.java index ef93c627..5a28cf1d 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationMockTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationMockTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,10 @@ */ package org.springframework.session.data.redis.config.annotation.web.http; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; @@ -33,15 +32,15 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; -@RunWith(MockitoJUnitRunner.class) public class RedisHttpSessionConfigurationMockTests { @Mock RedisConnectionFactory factory; @Mock RedisConnection connection; - @Before + @BeforeEach public void setup() { + MockitoAnnotations.initMocks(this); given(this.factory.getConnection()).willReturn(this.connection); } diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java index 32298105..bb4d4aba 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationNoOpConfigureRedisActionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,15 +16,15 @@ package org.springframework.session.data.redis.config.annotation.web.http; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.session.data.redis.config.ConfigureRedisAction; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.mockito.Mockito.mock; @@ -32,7 +32,7 @@ import static org.mockito.Mockito.mock; /** * @author Rob Winch */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class RedisHttpSessionConfigurationNoOpConfigureRedisActionTests { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideDefaultSerializerTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideDefaultSerializerTests.java index 7cbdef55..16b1baec 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideDefaultSerializerTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideDefaultSerializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package org.springframework.session.data.redis.config.annotation.web.http; import java.util.Properties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -30,7 +30,7 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.session.data.redis.config.annotation.SpringSessionRedisOperations; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock; * @author Mark Paluch * */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class RedisHttpSessionConfigurationOverrideDefaultSerializerTests { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideSessionTaskExecutor.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideSessionTaskExecutor.java index 8d29b41e..db561821 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideSessionTaskExecutor.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideSessionTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ package org.springframework.session.data.redis.config.annotation.web.http; import java.util.Properties; import java.util.concurrent.Executor; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -30,7 +30,7 @@ import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.listener.RedisMessageListenerContainer; import org.springframework.scheduling.SchedulingAwareRunnable; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.mockito.ArgumentMatchers.any; @@ -44,7 +44,7 @@ import static org.mockito.Mockito.verify; * @author Vladimir Tsanev * */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class RedisHttpSessionConfigurationOverrideSessionTaskExecutor { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideSessionTaskExecutors.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideSessionTaskExecutors.java index 6340d4de..9b7a9913 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideSessionTaskExecutors.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationOverrideSessionTaskExecutors.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ package org.springframework.session.data.redis.config.annotation.web.http; import java.util.Properties; import java.util.concurrent.Executor; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -30,7 +30,7 @@ import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.listener.RedisMessageListenerContainer; import org.springframework.scheduling.SchedulingAwareRunnable; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.mockito.ArgumentMatchers.any; @@ -46,7 +46,7 @@ import static org.mockito.Mockito.verify; * @author Mark Paluch * */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class RedisHttpSessionConfigurationOverrideSessionTaskExecutors { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationTests.java index 54d16e26..ab78e027 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationTests.java @@ -19,9 +19,9 @@ package org.springframework.session.data.redis.config.annotation.web.http; import java.util.Map; import java.util.Properties; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -57,12 +57,12 @@ public class RedisHttpSessionConfigurationTests { private AnnotationConfigApplicationContext context; - @Before + @BeforeEach public void before() { this.context = new AnnotationConfigApplicationContext(); } - @After + @AfterEach public void after() { if (this.context != null) { this.context.close(); diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlCustomExpireTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlCustomExpireTests.java index 8ba99274..fd118247 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlCustomExpireTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlCustomExpireTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,20 +18,20 @@ package org.springframework.session.data.redis.config.annotation.web.http; import java.util.Properties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class RedisHttpSessionConfigurationXmlCustomExpireTests { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlTests.java index 4ad9723e..bc81be91 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationXmlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,20 +18,20 @@ package org.springframework.session.data.redis.config.annotation.web.http; import java.util.Properties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class RedisHttpSessionConfigurationXmlTests { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/gh109/Gh109Tests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/gh109/Gh109Tests.java index 50ee5792..a1384b5c 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/gh109/Gh109Tests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/gh109/Gh109Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package org.springframework.session.data.redis.config.annotation.web.http.gh109; import java.util.Properties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; @@ -30,7 +30,7 @@ import org.springframework.data.redis.core.RedisOperations; import org.springframework.session.data.redis.RedisOperationsSessionRepository; import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.mockito.ArgumentMatchers.anyString; @@ -44,7 +44,7 @@ import static org.mockito.Mockito.mock; * @author Mark Paluch * @since 1.0.2 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class Gh109Tests { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/server/RedisWebSessionConfigurationTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/server/RedisWebSessionConfigurationTests.java index ff511a9d..2ab4a264 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/server/RedisWebSessionConfigurationTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/server/RedisWebSessionConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,9 @@ package org.springframework.session.data.redis.config.annotation.web.server; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -52,12 +52,12 @@ public class RedisWebSessionConfigurationTests { private AnnotationConfigApplicationContext context; - @Before + @BeforeEach public void before() { this.context = new AnnotationConfigApplicationContext(); } - @After + @AfterEach public void after() { if (this.context != null) { this.context.close(); diff --git a/spring-session-hazelcast/spring-session-hazelcast.gradle b/spring-session-hazelcast/spring-session-hazelcast.gradle index e0f6aa09..9d2d3378 100644 --- a/spring-session-hazelcast/spring-session-hazelcast.gradle +++ b/spring-session-hazelcast/spring-session-hazelcast.gradle @@ -9,6 +9,8 @@ dependencies { testCompile "javax.servlet:javax.servlet-api" testCompile "org.springframework:spring-web" testCompile "org.springframework.security:spring-security-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile "com.hazelcast:hazelcast-client" integrationTestCompile "org.testcontainers:testcontainers" diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/AbstractHazelcastRepositoryITests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/AbstractHazelcastRepositoryITests.java index 0b47ab6f..4d21d402 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/AbstractHazelcastRepositoryITests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/AbstractHazelcastRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ package org.springframework.session.hazelcast; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.IMap; import com.hazelcast.instance.HazelcastInstanceProxy; -import org.junit.Assume; -import org.junit.Test; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -208,8 +208,8 @@ public abstract class AbstractHazelcastRepositoryITests { @Test public void createSessionWithSecurityContextAndFindByPrincipal() { - Assume.assumeTrue("Hazelcast runs in embedded server topology", - this.hazelcastInstance instanceof HazelcastInstanceProxy); + Assumptions.assumeTrue(this.hazelcastInstance instanceof HazelcastInstanceProxy, + "Hazelcast runs in embedded server topology"); HazelcastSession session = this.repository.createSession(); diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastClientRepositoryITests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastClientRepositoryITests.java index 4bad5368..5c7783f2 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastClientRepositoryITests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastClientRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,9 @@ package org.springframework.session.hazelcast; import com.hazelcast.client.HazelcastClient; import com.hazelcast.client.config.ClientConfig; import com.hazelcast.core.HazelcastInstance; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.BindMode; import org.testcontainers.containers.GenericContainer; @@ -31,7 +31,7 @@ import org.springframework.session.MapSession; import org.springframework.session.Session; import org.springframework.session.hazelcast.config.annotation.web.http.EnableHazelcastHttpSession; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -42,7 +42,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * @author Artem Bilan * @since 1.1 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class HazelcastClientRepositoryITests extends AbstractHazelcastRepositoryITests { @@ -56,12 +56,12 @@ public class HazelcastClientRepositoryITests extends AbstractHazelcastRepository "/opt/hazelcast/config_ext/hazelcast.xml", BindMode.READ_ONLY); - @BeforeClass + @BeforeAll public static void setUpClass() { container.start(); } - @AfterClass + @AfterAll public static void tearDownClass() { container.stop(); } diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastServerRepositoryITests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastServerRepositoryITests.java index ab2b1f4a..1f20667c 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastServerRepositoryITests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastServerRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,13 @@ package org.springframework.session.hazelcast; import com.hazelcast.core.HazelcastInstance; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.session.hazelcast.config.annotation.web.http.EnableHazelcastHttpSession; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -33,7 +33,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * @author Tommy Ludwig * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class HazelcastServerRepositoryITests extends AbstractHazelcastRepositoryITests { diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java index aec89c45..6563abfd 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java @@ -20,9 +20,9 @@ import java.time.Duration; import java.time.Instant; import com.hazelcast.core.HazelcastInstance; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -41,7 +41,7 @@ import org.springframework.session.events.SessionExpiredEvent; import org.springframework.session.hazelcast.HazelcastITestUtils; import org.springframework.session.hazelcast.SessionEventRegistry; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Tommy Ludwig * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class EnableHazelcastHttpSessionEventsTests { @@ -67,7 +67,7 @@ public class EnableHazelcastHttpSessionEventsTests { @Autowired private SessionEventRegistry registry; - @Before + @BeforeEach public void setup() { this.registry.clear(); } diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationXmlTests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationXmlTests.java index 852bb215..f4e2182c 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationXmlTests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationXmlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ import com.hazelcast.config.Config; import com.hazelcast.config.NetworkConfig; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -32,7 +32,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.session.Session; import org.springframework.session.SessionRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.util.SocketUtils; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ public class HazelcastHttpSessionConfigurationXmlTests { - @RunWith(SpringRunner.class) + @ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public static class CustomXmlMapNameTest { @@ -84,7 +84,7 @@ public class HazelcastHttpSessionConfigurationXmlTests { } } - @RunWith(SpringRunner.class) + @ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public static class CustomXmlMapNameAndIdleTest { diff --git a/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/HazelcastSessionRepositoryTests.java b/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/HazelcastSessionRepositoryTests.java index 43221bed..c3c90f2c 100644 --- a/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/HazelcastSessionRepositoryTests.java +++ b/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/HazelcastSessionRepositoryTests.java @@ -28,8 +28,8 @@ import com.hazelcast.core.IMap; import com.hazelcast.map.EntryProcessor; import com.hazelcast.map.listener.MapListener; import com.hazelcast.query.impl.predicates.EqualPredicate; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; @@ -69,7 +69,7 @@ public class HazelcastSessionRepositoryTests { private HazelcastSessionRepository repository; - @Before + @BeforeEach public void setUp() { given(this.hazelcastInstance.getMap(anyString())) .willReturn(this.sessions); diff --git a/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java b/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java index 736c857f..3113c945 100644 --- a/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java +++ b/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package org.springframework.session.hazelcast.config.annotation.web.http; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.IMap; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -53,7 +53,7 @@ public class HazelcastHttpSessionConfigurationTests { private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - @After + @AfterEach public void closeContext() { if (this.context != null) { this.context.close(); diff --git a/spring-session-jdbc/spring-session-jdbc.gradle b/spring-session-jdbc/spring-session-jdbc.gradle index a1f22446..3984fef5 100644 --- a/spring-session-jdbc/spring-session-jdbc.gradle +++ b/spring-session-jdbc/spring-session-jdbc.gradle @@ -10,6 +10,8 @@ dependencies { testCompile "javax.servlet:javax.servlet-api" testCompile "org.springframework:spring-web" testCompile "org.springframework.security:spring-security-core" + testCompile "org.junit.jupiter:junit-jupiter-api" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine" integrationTestCompile "com.h2database:h2" integrationTestCompile "com.microsoft.sqlserver:mssql-jdbc" diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java index 3929d783..2a0a1c68 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java @@ -25,8 +25,8 @@ import java.util.function.Supplier; import javax.sql.DataSource; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -63,7 +63,7 @@ public abstract class AbstractJdbcOperationsSessionRepositoryITests { private SecurityContext changedContext; - @Before + @BeforeEach public void setUp() { this.context = SecurityContextHolder.createEmptyContext(); this.context.setAuthentication( diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/DerbyJdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/DerbyJdbcOperationsSessionRepositoryITests.java index e083d0c7..9864cb30 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/DerbyJdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/DerbyJdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -24,7 +24,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -32,7 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class DerbyJdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/H2JdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/H2JdbcOperationsSessionRepositoryITests.java index 4c9d79ae..1735f1fa 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/H2JdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/H2JdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -24,7 +24,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -32,7 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class H2JdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/HsqldbJdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/HsqldbJdbcOperationsSessionRepositoryITests.java index 3eaec989..8ed33dcc 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/HsqldbJdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/HsqldbJdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -24,7 +24,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -32,7 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class HsqldbJdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDb10JdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDb10JdbcOperationsSessionRepositoryITests.java index 8dc2d4db..ffa0d947 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDb10JdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDb10JdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.MariaDBContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -32,7 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class MariaDb10JdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDb5JdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDb5JdbcOperationsSessionRepositoryITests.java index 1d76d00a..fd59b22c 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDb5JdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MariaDb5JdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.MariaDBContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -32,7 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class MariaDb5JdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySql5JdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySql5JdbcOperationsSessionRepositoryITests.java index 5257fcae..2a990660 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySql5JdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySql5JdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.MySQLContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -31,7 +31,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class MySql5JdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySql8JdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySql8JdbcOperationsSessionRepositoryITests.java index 9d966398..995fd20e 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySql8JdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/MySql8JdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.MySQLContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -31,7 +31,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class MySql8JdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcOperationsSessionRepositoryITests.java index 1f313edf..11e51b55 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/OracleJdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,9 @@ package org.springframework.session.jdbc; -import org.junit.Assume; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.OracleContainer; import org.testcontainers.utility.TestcontainersConfiguration; @@ -26,7 +26,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.util.ClassUtils; @@ -38,19 +38,20 @@ import org.springframework.util.ClassUtils; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class OracleJdbcOperationsSessionRepositoryITests extends AbstractContainerJdbcOperationsSessionRepositoryITests { - @BeforeClass + @BeforeAll public static void setUpClass() { - Assume.assumeTrue("Oracle JDBC driver is present on the classpath", - ClassUtils.isPresent("oracle.jdbc.OracleDriver", null)); - Assume.assumeTrue("Testcontainers property `oracle.container.image` is set", + Assumptions.assumeTrue(ClassUtils.isPresent("oracle.jdbc.OracleDriver", null), + "Oracle JDBC driver is present on the classpath"); + Assumptions.assumeTrue( TestcontainersConfiguration.getInstance().getProperties() - .getProperty("oracle.container.image") != null); + .getProperty("oracle.container.image") != null, + "Testcontainers property `oracle.container.image` is set"); } @Configuration diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql10JdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql10JdbcOperationsSessionRepositoryITests.java index b8cf741b..ef3ae5ca 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql10JdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql10JdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.PostgreSQLContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -32,7 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class PostgreSql10JdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql11JdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql11JdbcOperationsSessionRepositoryITests.java index 52c1c793..e56573e9 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql11JdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql11JdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.PostgreSQLContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -32,7 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class PostgreSql11JdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql9JdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql9JdbcOperationsSessionRepositoryITests.java index 2b33d746..15ecb86a 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql9JdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/PostgreSql9JdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.PostgreSQLContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -32,7 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class PostgreSql9JdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcOperationsSessionRepositoryITests.java index 8d616b87..01895813 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/SqlServerJdbcOperationsSessionRepositoryITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.springframework.session.jdbc; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.testcontainers.containers.MSSQLServerContainer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -32,7 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * * @author Vedran Pavic */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextConfiguration public class SqlServerJdbcOperationsSessionRepositoryITests diff --git a/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/JdbcOperationsSessionRepositoryTests.java b/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/JdbcOperationsSessionRepositoryTests.java index 5b7cc5f5..90ba7295 100644 --- a/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/JdbcOperationsSessionRepositoryTests.java +++ b/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/JdbcOperationsSessionRepositoryTests.java @@ -23,8 +23,8 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.jdbc.core.BatchPreparedStatementSetter; @@ -74,7 +74,7 @@ public class JdbcOperationsSessionRepositoryTests { private JdbcOperationsSessionRepository repository; - @Before + @BeforeEach public void setUp() { this.repository = new JdbcOperationsSessionRepository(this.jdbcOperations, this.transactionManager); diff --git a/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/config/annotation/web/http/JdbcHttpSessionConfigurationTests.java b/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/config/annotation/web/http/JdbcHttpSessionConfigurationTests.java index 12067d84..566141a4 100644 --- a/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/config/annotation/web/http/JdbcHttpSessionConfigurationTests.java +++ b/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/config/annotation/web/http/JdbcHttpSessionConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package org.springframework.session.jdbc.config.annotation.web.http; import javax.sql.DataSource; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -57,7 +57,7 @@ public class JdbcHttpSessionConfigurationTests { private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - @After + @AfterEach public void closeContext() { if (this.context != null) { this.context.close();