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:
2026-05-20 17:36:22 +02:00
parent 1ba85e129e
commit a7b984ca84
7 changed files with 27 additions and 29 deletions
@@ -1,5 +1,7 @@
package com.vaessl.app.search;
import static com.vaessl.app.Mockdata.MOCK_PASS;
import static com.vaessl.app.Mockdata.MOCK_USER;
import static com.vaessl.app.connection.Endpoint.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@@ -24,10 +26,6 @@ class SearchControllerTest {
@Autowired
MockMvc mockMvc;
private static final String TEST_USER = "admin";
private static final String TEST_PASS = "pw";
private static final String QUERY_ALL_ITEMS = HOMEBOX_QUERY_ALL_ITEMS.getValue();
private static final String LOGIN_PATH = LOGIN.getValue();
@@ -138,7 +136,7 @@ class SearchControllerTest {
"serviceType": "%s",
"username": "%s"
}
""".formatted(wm.getHttpBaseUrl(), serviceType, TEST_USER);
""".formatted(wm.getHttpBaseUrl(), serviceType, MOCK_USER);
}
private String connectionRequestBody(WireMockRuntimeInfo wm) {
@@ -149,6 +147,6 @@ class SearchControllerTest {
"username": "%s",
"password": "%s"
}
""".formatted(wm.getHttpBaseUrl(), TEST_USER, TEST_PASS);
""".formatted(wm.getHttpBaseUrl(), MOCK_USER, MOCK_PASS);
}
}