From c59c256fa6d5934e23b6e4898d4512dd2a36cc9d Mon Sep 17 00:00:00 2001
From: Robert McNees <86265089+robertmcnees@users.noreply.github.com>
Date: Wed, 7 Jul 2021 14:06:51 -0400
Subject: [PATCH] Upgrade JUnit version (#973) (#975)
* Upgrade JUnit version (#973)
See gh-973
---
.../pom.xml | 5 -----
.../integration/JdbcConfigurationTests.java | 2 +-
.../RefreshScopeIntegrationTests.java | 20 +++++++++----------
3 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/spring-cloud-context-integration-tests/pom.xml b/spring-cloud-context-integration-tests/pom.xml
index d0eedb67..301f06cd 100644
--- a/spring-cloud-context-integration-tests/pom.xml
+++ b/spring-cloud-context-integration-tests/pom.xml
@@ -60,11 +60,6 @@
spring-boot-configuration-processor
true
-
- org.junit.vintage
- junit-vintage-engine
- test
-
diff --git a/spring-cloud-context-integration-tests/src/test/java/org/springframework/cloud/context/integration/JdbcConfigurationTests.java b/spring-cloud-context-integration-tests/src/test/java/org/springframework/cloud/context/integration/JdbcConfigurationTests.java
index ada3a53a..f33294f1 100644
--- a/spring-cloud-context-integration-tests/src/test/java/org/springframework/cloud/context/integration/JdbcConfigurationTests.java
+++ b/spring-cloud-context-integration-tests/src/test/java/org/springframework/cloud/context/integration/JdbcConfigurationTests.java
@@ -16,7 +16,7 @@
package org.springframework.cloud.context.integration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.WebApplicationType;
diff --git a/spring-cloud-context-integration-tests/src/test/java/org/springframework/cloud/context/integration/RefreshScopeIntegrationTests.java b/spring-cloud-context-integration-tests/src/test/java/org/springframework/cloud/context/integration/RefreshScopeIntegrationTests.java
index 098db40a..be8bb6c0 100644
--- a/spring-cloud-context-integration-tests/src/test/java/org/springframework/cloud/context/integration/RefreshScopeIntegrationTests.java
+++ b/spring-cloud-context-integration-tests/src/test/java/org/springframework/cloud/context/integration/RefreshScopeIntegrationTests.java
@@ -18,10 +18,10 @@ package org.springframework.cloud.context.integration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-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.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.scope.ScopedProxyUtils;
@@ -41,11 +41,9 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.BDDAssertions.then;
-@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestConfiguration.class)
@SuppressWarnings("Duplicates")
public class RefreshScopeIntegrationTests {
@@ -59,13 +57,13 @@ public class RefreshScopeIntegrationTests {
@Autowired
private org.springframework.cloud.context.scope.refresh.RefreshScope scope;
- @Before
+ @BeforeEach
public void init() {
then(ExampleService.getInitCount()).isEqualTo(1);
ExampleService.reset();
}
- @After
+ @AfterEach
public void close() {
ExampleService.reset();
}
@@ -121,10 +119,12 @@ public class RefreshScopeIntegrationTests {
}
// see gh-349
- @Test(expected = ServiceException.class)
+ @Test
@DirtiesContext
public void testCheckedException() throws Exception {
- this.service.throwsException();
+ Assertions.assertThrows(ServiceException.class, () -> {
+ this.service.throwsException();
+ });
}
public interface Service {