Polish
This commit is contained in:
parent
3799496dc8
commit
971913e672
|
|
@ -84,11 +84,10 @@ public class HalBrowserMvcEndpointServerContextPathIntegrationTests {
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||||
ResponseEntity<String> entity = new TestRestTemplate().exchange(
|
ResponseEntity<String> entity = new TestRestTemplate().exchange(
|
||||||
"http://localhost:" + this.port + "/spring/actuator/browser.html", HttpMethod.GET,
|
"http://localhost:" + this.port + "/spring/actuator/browser.html",
|
||||||
new HttpEntity<Void>(null, headers), String.class);
|
HttpMethod.GET, new HttpEntity<Void>(null, headers), String.class);
|
||||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||||
assertTrue("Wrong body: " + entity.getBody(),
|
assertThat(entity.getBody()).contains("entryPoint: '/spring/actuator'");
|
||||||
entity.getBody().contains("entryPoint: '/spring/actuator'"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,10 @@ public class ElasticsearchJestHealthIndicatorTests {
|
||||||
|
|
||||||
private final JestClient jestClient = mock(JestClient.class);
|
private final JestClient jestClient = mock(JestClient.class);
|
||||||
|
|
||||||
private final ElasticsearchJestHealthIndicator healthIndicator =
|
private final ElasticsearchJestHealthIndicator healthIndicator = new ElasticsearchJestHealthIndicator(
|
||||||
new ElasticsearchJestHealthIndicator(this.jestClient);
|
this.jestClient);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void elasticSearchIsUp() throws IOException {
|
public void elasticSearchIsUp() throws IOException {
|
||||||
given(this.jestClient.execute(any(Action.class)))
|
given(this.jestClient.execute(any(Action.class)))
|
||||||
|
|
@ -52,6 +53,8 @@ public class ElasticsearchJestHealthIndicatorTests {
|
||||||
Health health = this.healthIndicator.health();
|
Health health = this.healthIndicator.health();
|
||||||
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void elasticSearchIsDown() throws IOException {
|
public void elasticSearchIsDown() throws IOException {
|
||||||
given(this.jestClient.execute(any(Action.class))).willThrow(
|
given(this.jestClient.execute(any(Action.class))).willThrow(
|
||||||
|
|
@ -61,6 +64,7 @@ public class ElasticsearchJestHealthIndicatorTests {
|
||||||
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
|
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void elasticSearchIsOutOfService() throws IOException {
|
public void elasticSearchIsOutOfService() throws IOException {
|
||||||
given(this.jestClient.execute(any(Action.class)))
|
given(this.jestClient.execute(any(Action.class)))
|
||||||
|
|
@ -71,11 +75,8 @@ public class ElasticsearchJestHealthIndicatorTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static JestResult createJestResult(int shards, int failedShards) {
|
private static JestResult createJestResult(int shards, int failedShards) {
|
||||||
String json = String.format("{_shards: {\n" +
|
String json = String.format("{_shards: {\n" + "total: %s,\n" + "successful: %s,\n"
|
||||||
"total: %s,\n" +
|
+ "failed: %s\n" + "}}", shards, shards - failedShards, failedShards);
|
||||||
"successful: %s,\n" +
|
|
||||||
"failed: %s\n" +
|
|
||||||
"}}", shards, shards - failedShards, failedShards);
|
|
||||||
|
|
||||||
SearchResult searchResult = new SearchResult(new Gson());
|
SearchResult searchResult = new SearchResult(new Gson());
|
||||||
searchResult.setJsonString(json);
|
searchResult.setJsonString(json);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue