diff options
author | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2018-09-19 10:33:39 +0200 |
---|---|---|
committer | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2018-09-25 07:43:45 +0200 |
commit | f24045484892ec59f5aff1c42252ae0ec10e2f66 (patch) | |
tree | 990d3605bffbe7e7facf3101aff6ca5929204a7e /vid-app-common/src/test/java/org | |
parent | e40ad0f69d7e1241dbb0fd17412067353c44eb85 (diff) |
Add junits to commit info endpoint
Change-Id: I0a904ba7259bee2c10cde0a3c6be0552b03cfeb2
Issue-ID: VID-311
Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Diffstat (limited to 'vid-app-common/src/test/java/org')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java index ca7a163a8..6055bc390 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java @@ -1,18 +1,32 @@ package org.onap.vid.controllers; +import org.apache.log4j.BasicConfigurator; +import org.junit.Before; import org.junit.Test; -import org.onap.vid.controllers.HealthCheckController; import org.onap.vid.controllers.HealthCheckController.HealthStatus; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + public class HealthCheckControllerTest { - private HealthCheckController createTestSubject() { - return new HealthCheckController(); + private HealthCheckController testSubject; + private MockMvc mockMvc; + + @Before + public void setUp() { + testSubject = new HealthCheckController(); + BasicConfigurator.configure(); + mockMvc = MockMvcBuilders.standaloneSetup(testSubject).build(); } @Test public void testGetProfileCount() throws Exception { - HealthCheckController testSubject; String driver = ""; String URL = ""; String username = ""; @@ -20,29 +34,34 @@ public class HealthCheckControllerTest { int result; // default test - testSubject = createTestSubject(); result = testSubject.getProfileCount(driver, URL, username, password); } @Test public void testGethealthCheckStatusforIDNS() throws Exception { - HealthCheckController testSubject; HealthStatus result; // default test - testSubject = createTestSubject(); result = testSubject.gethealthCheckStatusforIDNS(); } @Test public void testGetHealthCheck() throws Exception { - HealthCheckController testSubject; String UserAgent = ""; String ECOMPRequestID = ""; HealthStatus result; // default test - testSubject = createTestSubject(); result = testSubject.getHealthCheck(UserAgent, ECOMPRequestID); } + + @Test + public void testCommitInfoEndpoint() throws Exception { + mockMvc.perform(get("/commitInfo") + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.commitId").value("123987")) + .andExpect(jsonPath("$.commitMessageShort").value("Test short commit message")) + .andExpect(jsonPath("$.commitTime").value("1999-09-12T13:48:55+0200")); + } }
\ No newline at end of file |