Skip to content

Commit 67f9f52

Browse files
committed
Reformatting
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
1 parent eb42a7b commit 67f9f52

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

src/test/java/io/securecodebox/persistence/defectdojo/service/UserProfileServiceTest.java

+36-36
Original file line numberDiff line numberDiff line change
@@ -27,45 +27,45 @@
2727
// but the generic code assumes every endpoint returns a list
2828
class UserProfileServiceTest {
2929

30-
private Config config;
31-
private UserProfileService underTest;
32-
private MockRestServiceServer mockServer;
30+
private Config config;
31+
private UserProfileService underTest;
32+
private MockRestServiceServer mockServer;
3333

34-
// This string does not contain every field of the api response as those are not implemented
35-
private String apiResponse = """
36-
{
37-
"user": {
38-
"id": 0,
39-
"username": "GdqmXprK.j7R+OYE49SzL3mM2U6I0DyLRHnDg87i9It0AfP-kxvswW3qOI2i+31-@0",
40-
"first_name": "string",
41-
"last_name": "string",
42-
"email": "user@example.com",
43-
"last_login": "2022-11-01T16:20:19.373Z",
44-
"is_active": true,
45-
"is_superuser": true,
46-
"configuration_permissions": [0]
47-
}
48-
}
49-
""";
50-
51-
@BeforeEach
52-
void setup() {
53-
config = new Config("https://defectdojo.example.com", "abc", 42);
54-
underTest = new UserProfileService(config);
55-
mockServer = MockRestServiceServer.createServer(underTest.getRestTemplate());
34+
// This string does not contain every field of the api response as those are not implemented
35+
private String apiResponse = """
36+
{
37+
"user": {
38+
"id": 0,
39+
"username": "GdqmXprK.j7R+OYE49SzL3mM2U6I0DyLRHnDg87i9It0AfP-kxvswW3qOI2i+31-@0",
40+
"first_name": "string",
41+
"last_name": "string",
42+
"email": "user@example.com",
43+
"last_login": "2022-11-01T16:20:19.373Z",
44+
"is_active": true,
45+
"is_superuser": true,
46+
"configuration_permissions": [0]
47+
}
5648
}
49+
""";
5750

58-
@Test
59-
void testSearch() throws JsonProcessingException, URISyntaxException {
60-
var url = config.getUrl() + "/api/v2/" + underTest.getUrlPath() + "/?offset=0&limit=100";
61-
mockServer.expect(requestTo(url)).andRespond(withSuccess(apiResponse, MediaType.APPLICATION_JSON));
51+
@BeforeEach
52+
void setup() {
53+
config = new Config("https://defectdojo.example.com", "abc", 42);
54+
underTest = new UserProfileService(config);
55+
mockServer = MockRestServiceServer.createServer(underTest.getRestTemplate());
56+
}
6257

63-
var user = new User(0L, "GdqmXprK.j7R+OYE49SzL3mM2U6I0DyLRHnDg87i9It0AfP-kxvswW3qOI2i+31-@0", "string", "string");
64-
var userProfile = new UserProfile(user);
65-
var expected = Arrays.asList(userProfile);
66-
var actual = underTest.search();
58+
@Test
59+
void testSearch() throws JsonProcessingException, URISyntaxException {
60+
var url = config.getUrl() + "/api/v2/" + underTest.getUrlPath() + "/?offset=0&limit=100";
61+
mockServer.expect(requestTo(url)).andRespond(withSuccess(apiResponse, MediaType.APPLICATION_JSON));
6762

68-
mockServer.verify();
69-
assertIterableEquals(expected, actual);
70-
}
63+
var user = new User(0L, "GdqmXprK.j7R+OYE49SzL3mM2U6I0DyLRHnDg87i9It0AfP-kxvswW3qOI2i+31-@0", "string", "string");
64+
var userProfile = new UserProfile(user);
65+
var expected = Arrays.asList(userProfile);
66+
var actual = underTest.search();
67+
68+
mockServer.verify();
69+
assertIterableEquals(expected, actual);
70+
}
7171
}

0 commit comments

Comments
 (0)