Skip to content

Commit a47cbb0

Browse files
committed
[JAVA-42811] Use dynamic port
1 parent 6fde134 commit a47cbb0

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/fileupload/FileUploadUnitTest.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.github.tomakehurst.wiremock.client.WireMock.matching
88
import com.github.tomakehurst.wiremock.client.WireMock.post
99
import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor
1010
import com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo
11+
import com.github.tomakehurst.wiremock.core.WireMockConfiguration
1112
import com.github.tomakehurst.wiremock.junit.WireMockRule
1213
import io.ktor.client.HttpClient
1314
import io.ktor.client.engine.cio.CIO
@@ -18,16 +19,12 @@ import io.ktor.client.statement.readText
1819
import io.ktor.http.Headers
1920
import io.ktor.http.HttpHeaders
2021
import kotlinx.coroutines.runBlocking
21-
import okhttp3.Call
22-
import okhttp3.Callback
2322
import okhttp3.MediaType.Companion.toMediaTypeOrNull
2423
import okhttp3.MultipartBody
2524
import okhttp3.OkHttpClient
2625
import okhttp3.Request
2726
import okhttp3.RequestBody.Companion.asRequestBody
28-
import okhttp3.Response
2927
import okhttp3.ResponseBody
30-
import okhttp3.internal.wait
3128
import org.junit.jupiter.api.AfterEach
3229
import org.junit.jupiter.api.BeforeEach
3330
import org.junit.Rule
@@ -38,7 +35,6 @@ import retrofit2.http.Multipart
3835
import retrofit2.http.POST
3936
import retrofit2.http.Part
4037
import java.io.File
41-
import java.io.IOException
4238

4339
fun uploadFileFuel(filePath: String, uploadUrl: String) {
4440
val file = File(filePath)
@@ -112,7 +108,7 @@ fun uploadFileRetrofit(filePath: String, uploadUrl: String) {
112108
class FileUploadUnitTest {
113109
@Rule
114110
@JvmField
115-
val wireMockRule = WireMockRule(8080)
111+
val wireMockRule = WireMockRule(WireMockConfiguration.wireMockConfig().dynamicPort())
116112

117113
@BeforeEach
118114
fun startWireMock() {

0 commit comments

Comments
 (0)