- final ApexMain apexMain = new ApexMain(args);
- ThreadUtilities.sleep(1000);
- apexMain.shutdown();
-
- final String outString = outContent.toString();
- System.setOut(stdout);
- System.setErr(stderr);
-
- Response response = null;
- response = client.target("http://localhost:32801/TestExecutionRest/apex/event/GetProperUrl")
- .request("application/json").get();
-
- LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outString + "\nEnd-TagUrl");
- final String responseEntity = response.readEntity(String.class);
- assertTrue(responseEntity.contains("\"PostProperUrl\": 1"));
+ apexMain = new ApexMain(args);
+
+ await().atMost(5, TimeUnit.SECONDS).until(() -> {
+ Response response = client.target("http://localhost:32801/TestExecutionRest/apex/event/GetProperUrl")
+ .request("application/json").get();
+ return response.readEntity(String.class).contains("\"PostProperUrl\": 1");
+ });
+ assertTrue(apexMain.isAlive());
+ LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outContent.toString() + "\nEnd-TagUrl");