Skip to content

Commit f48e4c3

Browse files
committed
test: migrate S3ConfigResolverTest from JUnit 4 to JUnit 5
- Replace @BeforeClass/@afterclass with @BeforeAll/@afterall - Replace @after with @AfterEach - Update imports to use JUnit 5 API - Simplify assertion imports
1 parent f9cd37e commit f48e4c3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

core/config-resolver-s3/src/test/java/io/gatehill/imposter/config/resolver/S3ConfigResolverTest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ import io.gatehill.imposter.config.support.TestSupport.startS3Mock
5252
import io.gatehill.imposter.util.TestEnvironmentUtil.assumeDockerAccessible
5353
import io.vertx.core.AsyncResult
5454
import io.vertx.core.Vertx
55-
import org.junit.*
56-
import org.junit.jupiter.api.Assertions
55+
import org.junit.jupiter.api.*
5756
import org.junit.jupiter.api.Assertions.assertFalse
5857
import org.junit.jupiter.api.Assertions.assertTrue
59-
import org.junit.jupiter.api.BeforeEach
58+
import org.junit.jupiter.api.Assertions.assertNotNull
59+
import org.junit.jupiter.api.Assertions.assertEquals
6060

6161
/**
6262
* Verifies loading remote config.
@@ -83,7 +83,7 @@ class S3ConfigResolverTest {
8383
TestSupport.uploadFileToS3(s3Mock!!, "/config", "subdir/response.json")
8484
}
8585

86-
@After
86+
@AfterEach
8787
fun tearDown() {
8888
try {
8989
s3Mock?.takeIf { it.isRunning }?.stop()
@@ -109,21 +109,21 @@ class S3ConfigResolverTest {
109109
@Throws(Exception::class)
110110
fun testLoadConfigFromS3() {
111111
val localConfigDir = s3ConfigResolver.resolve("s3://test")
112-
Assertions.assertNotNull(localConfigDir.exists(), "config should be fetched from S3")
113-
Assertions.assertEquals(localConfigDir.listFiles().size, 3, "files should be downloaded from S3")
112+
assertNotNull(localConfigDir.exists(), "config should be fetched from S3")
113+
assertEquals(localConfigDir.listFiles().size, 3, "files should be downloaded from S3")
114114
}
115115

116116
companion object {
117117
private var vertx: Vertx? = null
118118

119119
@JvmStatic
120-
@BeforeClass
120+
@BeforeAll
121121
fun beforeClass() {
122122
vertx = Vertx.vertx()
123123
}
124124

125125
@JvmStatic
126-
@AfterClass
126+
@AfterAll
127127
@Throws(Exception::class)
128128
fun afterClass() {
129129
blockWait<AsyncResult<Void>?> { completionHandler -> vertx!!.close(completionHandler) }

0 commit comments

Comments
 (0)