JAVA-15245 use dynamic port (#12910)
This commit is contained in:
parent
18c8a5eddc
commit
f0686dd5bd
@ -19,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|||||||
import static com.github.tomakehurst.wiremock.client.WireMock.*;
|
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.request.MockMvcRequestBuilders.get;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@WebMvcTest(ProductController.class)
|
@WebMvcTest(ProductController.class)
|
||||||
@ -36,9 +37,9 @@ public class ProductControllerUnitTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void startWireMockServer() {
|
public void startWireMockServer() {
|
||||||
wireMockServer = new WireMockServer(8084);
|
wireMockServer = new WireMockServer(options().dynamicPort());
|
||||||
configureFor("localhost", 8084);
|
|
||||||
wireMockServer.start();
|
wireMockServer.start();
|
||||||
|
configureFor("localhost", wireMockServer.port());
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
Loading…
x
Reference in New Issue
Block a user