BAEL-3253: Use a random port number for Tomcat (#8351)

* BAEL-3253: Use a random port number for Tomcat

* BAEL-3253: Validate a port availability
This commit is contained in:
kwoyke
2019-12-13 11:38:28 +01:00
committed by Grzegorz Piwowarek
parent 1f0ab8ba5b
commit f9f1534394
2 changed files with 31 additions and 2 deletions
@@ -37,7 +37,8 @@ public class ProgrammaticTomcatIntegrationTest {
@Test
public void givenTomcatStarted_whenAccessServlet_responseIsTestAndResponseHeaderIsSet() throws Exception {
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
HttpGet getServlet = new HttpGet("http://localhost:8080/my-servlet");
String uri = "http://localhost:" + tomcat.getPort() + "/my-servlet";
HttpGet getServlet = new HttpGet(uri);
HttpResponse response = httpClient.execute(getServlet);
assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());