diff --git a/pom.xml b/pom.xml index ad54260..99c1697 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,11 @@ org.springframework.boot spring-boot-starter-actuator + + joda-time + joda-time + 2.9.2 + diff --git a/src/main/java/hello/HelloController.java b/src/main/java/hello/HelloController.java index 3ddc129..43a877e 100644 --- a/src/main/java/hello/HelloController.java +++ b/src/main/java/hello/HelloController.java @@ -2,13 +2,15 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping; +import org.joda.time.LocalTime; @RestController public class HelloController { @RequestMapping("/data") public String index() { - return "Greetings from Spring Boot!"; //"Greetings from Spring Boot!"; + LocalTime currentTime = new LocalTime(); + return "Greetings from Spring Boot!" + currentTime; //"Greetings from Spring Boot!"; } } \ No newline at end of file diff --git a/src/test/java/hello/HelloControllerIT.java b/src/test/java/hello/HelloControllerIT.java index 4f914c1..7895c22 100644 --- a/src/test/java/hello/HelloControllerIT.java +++ b/src/test/java/hello/HelloControllerIT.java @@ -36,6 +36,6 @@ public void setUp() throws Exception { public void getHello() throws Exception { ResponseEntity response = template.getForEntity(base.toString(), String.class); - assertThat(response.getBody(), equalTo("Greetings from Spring Boot!")); + assertThat(response.getBody(), containsString("Greetings from Spring Boot!")); } } \ No newline at end of file diff --git a/src/test/java/hello/HelloControllerTest.java b/src/test/java/hello/HelloControllerTest.java index f0ea53e..1c4dcd1 100644 --- a/src/test/java/hello/HelloControllerTest.java +++ b/src/test/java/hello/HelloControllerTest.java @@ -1,6 +1,6 @@ package hello; -import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -26,6 +26,6 @@ public class HelloControllerTest { public void getHello() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/data").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) - .andExpect(content().string(equalTo("Greetings from Spring Boot!"))); + .andExpect(content().string(containsString("Greetings from Spring Boot!"))); } } \ No newline at end of file