refactor: consolidate test mock constants into shared Mockdata class
Moved Mockdata from the connection package to the root test package and extended it with MOCK_USER, MOCK_PASS, MOCK_TITLE, and MOCK_DESCRIPTION so all test modules share a single source of truth. Removed duplicate inline constants from ConnectionControllerTest, HomeboxIntegrationTest, and SearchControllerTest. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.vaessl.app.connection;
|
||||
|
||||
import static com.vaessl.app.Mockdata.*;
|
||||
|
||||
import static com.vaessl.app.connection.Endpoint.*;
|
||||
import static com.vaessl.app.connection.ServiceType.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
@@ -27,8 +29,6 @@ class ConnectionControllerTest {
|
||||
@Autowired
|
||||
MockMvc mockMvc;
|
||||
|
||||
private static final String TEST_USER = "admin";
|
||||
private static final String TEST_PASS = "pw";
|
||||
private static final String LOGIN_PATH = LOGIN.getValue();
|
||||
private static final String STATUS_PATH = CONNECTION_STATUS.getValue();
|
||||
private static final String LOGOUT_PATH = "/connections/HOMEBOX";
|
||||
@@ -71,7 +71,7 @@ class ConnectionControllerTest {
|
||||
mockMvc.perform(get(STATUS_PATH).cookie(sessionCookie)).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.length()").value(1))
|
||||
.andExpect(jsonPath("$[0].serviceType").value(HOMEBOX.getValue()))
|
||||
.andExpect(jsonPath("$[0].username").value(TEST_USER))
|
||||
.andExpect(jsonPath("$[0].username").value(MOCK_USER))
|
||||
.andExpect(jsonPath("$[0].appUrl").value(wm.getHttpBaseUrl()))
|
||||
.andExpect(jsonPath("$[0].connected").value(true));
|
||||
}
|
||||
@@ -149,6 +149,6 @@ class ConnectionControllerTest {
|
||||
"username": "%s",
|
||||
"password": "%s"
|
||||
}
|
||||
""".formatted(wm.getHttpBaseUrl(), TEST_USER, TEST_PASS);
|
||||
""".formatted(wm.getHttpBaseUrl(), MOCK_USER, MOCK_PASS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user