blob: 6055bc39053723ae5aa2169fc29965a155327c79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package org.onap.vid.controllers;
import org.apache.log4j.BasicConfigurator;
import org.junit.Before;
import org.junit.Test;
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 testSubject;
private MockMvc mockMvc;
@Before
public void setUp() {
testSubject = new HealthCheckController();
BasicConfigurator.configure();
mockMvc = MockMvcBuilders.standaloneSetup(testSubject).build();
}
@Test
public void testGetProfileCount() throws Exception {
String driver = "";
String URL = "";
String username = "";
String password = "";
int result;
// default test
result = testSubject.getProfileCount(driver, URL, username, password);
}
@Test
public void testGethealthCheckStatusforIDNS() throws Exception {
HealthStatus result;
// default test
result = testSubject.gethealthCheckStatusforIDNS();
}
@Test
public void testGetHealthCheck() throws Exception {
String UserAgent = "";
String ECOMPRequestID = "";
HealthStatus result;
// default test
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"));
}
}
|