JAVA-15245 use dynamic port (#12910)

This commit is contained in:
Loredana Crusoveanu 2022-11-04 18:35:10 +02:00 committed by GitHub
parent 18c8a5eddc
commit f0686dd5bd
1 changed files with 3 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
@RunWith(SpringRunner.class)
@WebMvcTest(ProductController.class)
@ -36,9 +37,9 @@ public class ProductControllerUnitTest {
@Before
public void startWireMockServer() {
wireMockServer = new WireMockServer(8084);
configureFor("localhost", 8084);
wireMockServer = new WireMockServer(options().dynamicPort());
wireMockServer.start();
configureFor("localhost", wireMockServer.port());
}
@After