1313
1414@ SpringBootTest (
1515 webEnvironment = RANDOM_PORT ,
16- properties = {"spring.cloud.config.enabled: false" })
16+ properties = {
17+ "spring.cloud.config.enabled: false" ,
18+ "eureka.client.register-with-eureka: false" ,
19+ "eureka.client.fetch-registry: false" ,
20+ "app.eureka.user: mt" ,
21+ "app.eureka.pass: p"
22+ })
1723class EurekaDiscoveryServerTests {
1824
19- @ Value ("${app.eureka.username }" )
25+ @ Value ("${app.eureka.user }" )
2026 private String username ;
2127
22- @ Value ("${app.eureka.password }" )
28+ @ Value ("${app.eureka.pass }" )
2329 private String password ;
2430
2531 private TestRestTemplate testRestTemplate ;
@@ -32,20 +38,19 @@ public void setTestRestTemplate(TestRestTemplate testRestTemplate) {
3238 @ Test
3339 public void catalogLoads () {
3440
35- String expectedResponseBody =
36- "{\" applications\" :{\" versions__delta\" :\" 1\" ," +
37- "\" apps__hashcode\" :\" \" ,\" application\" :[]}}" ;
38- ResponseEntity <String > entity = testRestTemplate .getForEntity ("/eureka/apps" , String .class );
39- assertEquals (HttpStatus .OK , entity .getStatusCode ());
40- assertEquals (expectedResponseBody , entity .getBody ());
41- }
42-
43- @ Test
44- public void healthy () {
45- String expectedResponseBody = "{\" status\" :\" UP\" }" ;
46- ResponseEntity <String > entity = testRestTemplate .getForEntity ("/actuator/health" , String .class );
47- assertEquals (HttpStatus .OK , entity .getStatusCode ());
48- assertEquals (expectedResponseBody , entity .getBody ());
49- }
41+ String expectedResponseBody =
42+ "{\" applications\" :{\" versions__delta\" :\" 1\" ,"
43+ + "\" apps__hashcode\" :\" \" ,\" application\" :[]}}" ;
44+ ResponseEntity <String > entity = testRestTemplate .getForEntity ("/eureka/apps" , String .class );
45+ assertEquals (HttpStatus .OK , entity .getStatusCode ());
46+ assertEquals (expectedResponseBody , entity .getBody ());
47+ }
5048
49+ @ Test
50+ public void healthy () {
51+ String expectedResponseBody = "{\" status\" :\" UP\" }" ;
52+ ResponseEntity <String > entity = testRestTemplate .getForEntity ("/actuator/health" , String .class );
53+ assertEquals (HttpStatus .OK , entity .getStatusCode ());
54+ assertEquals (expectedResponseBody , entity .getBody ());
55+ }
5156}
0 commit comments