Created
December 3, 2017 17:46
-
-
Save Romeh/5c51906140851f1c4d8fd98efdafff33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationSanityCheck{ | |
@Rule | |
public final RetryRule retry = new RetryRule(); | |
private int port = 8080; | |
private RestTemplate template; | |
private URL base; | |
@Before | |
public void setUp() throws Exception { | |
this.base = new URL("http://localhost:" + port + "/"); | |
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); | |
template = new RestTemplate(requestFactory); | |
} | |
@Test | |
// example of true end to end call which call UAT real endpoint | |
// and retry in case of failure 4 times with 20 seconds delay between each try | |
@Retry(times = 4, timeout = 20000) | |
public void test_is_server_up() { | |
assertTrue(template.getForEntity(base + "/health", String.class).getStatusCode().is2xxSuccessful()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment