Skip to content
Snippets Groups Projects
Commit cc4bd47c authored by Lukas Malte Monnerjahn's avatar Lukas Malte Monnerjahn
Browse files

OZG-6897 vararg

parent ec928ce7
No related branches found
No related tags found
No related merge requests found
...@@ -181,8 +181,6 @@ class UserResourceMapperTest { ...@@ -181,8 +181,6 @@ class UserResourceMapperTest {
@DisplayName("Map organisations einheit ids") @DisplayName("Map organisations einheit ids")
@Nested @Nested
class TestMapOrganisationsEinheitIds { class TestMapOrganisationsEinheitIds {
private UserResource userResource;
static final String ORGANISATIONS_EINHEIT_ID_3 = "6287"; static final String ORGANISATIONS_EINHEIT_ID_3 = "6287";
private final GroupRepresentation group1 = GroupRepresentationTestFactory.createByPathAndOrganisationEinheitIds( private final GroupRepresentation group1 = GroupRepresentationTestFactory.createByPathAndOrganisationEinheitIds(
GROUP_1_PATH, ORGANISATIONS_EINHEIT_ID_1, ORGANISATIONS_EINHEIT_ID_3); GROUP_1_PATH, ORGANISATIONS_EINHEIT_ID_1, ORGANISATIONS_EINHEIT_ID_3);
...@@ -196,7 +194,7 @@ class UserResourceMapperTest { ...@@ -196,7 +194,7 @@ class UserResourceMapperTest {
@Test @Test
void shouldMapOrganisationsEinheitIdsFromSingleGroup() { void shouldMapOrganisationsEinheitIdsFromSingleGroup() {
userResource = UserResourceTestFactory.createWithGroups(List.of(group1)); var userResource = UserResourceTestFactory.createWithGroups(group1);
when(realm.getGroupByPath(GROUP_1_PATH)).thenReturn(group1); when(realm.getGroupByPath(GROUP_1_PATH)).thenReturn(group1);
var result = mapper.mapOrganisationsEinheitIds(userResource); var result = mapper.mapOrganisationsEinheitIds(userResource);
...@@ -206,7 +204,7 @@ class UserResourceMapperTest { ...@@ -206,7 +204,7 @@ class UserResourceMapperTest {
@Test @Test
void shouldMapOrganisationsEinheitIdsFromGroups() { void shouldMapOrganisationsEinheitIdsFromGroups() {
userResource = UserResourceTestFactory.createWithGroups(List.of(group1, group2)); var userResource = UserResourceTestFactory.createWithGroups(group1, group2);
when(realm.getGroupByPath(GROUP_1_PATH)).thenReturn(group1); when(realm.getGroupByPath(GROUP_1_PATH)).thenReturn(group1);
when(realm.getGroupByPath(GROUP_2_PATH)).thenReturn(group2); when(realm.getGroupByPath(GROUP_2_PATH)).thenReturn(group2);
...@@ -222,7 +220,7 @@ class UserResourceMapperTest { ...@@ -222,7 +220,7 @@ class UserResourceMapperTest {
@Test @Test
void shouldMapOrganisationsEinheitIdsFromUser() { void shouldMapOrganisationsEinheitIdsFromUser() {
var attributes = Map.of(ORGANISATIONS_EINHEIT_ID_KEY, List.of(ORGANISATIONS_EINHEIT_ID_1, ORGANISATIONS_EINHEIT_ID_2)); var attributes = Map.of(ORGANISATIONS_EINHEIT_ID_KEY, List.of(ORGANISATIONS_EINHEIT_ID_1, ORGANISATIONS_EINHEIT_ID_2));
userResource = UserResourceTestFactory.createWithAttributes(attributes); var userResource = UserResourceTestFactory.createWithAttributes(attributes);
var result = mapper.mapOrganisationsEinheitIds(userResource); var result = mapper.mapOrganisationsEinheitIds(userResource);
...@@ -231,7 +229,7 @@ class UserResourceMapperTest { ...@@ -231,7 +229,7 @@ class UserResourceMapperTest {
@Test @Test
void shouldReturnEmptyIfNoOrganisationsEinheitIds() { void shouldReturnEmptyIfNoOrganisationsEinheitIds() {
userResource = UserResourceTestFactory.create(); var userResource = UserResourceTestFactory.create();
var result = mapper.mapOrganisationsEinheitIds(userResource); var result = mapper.mapOrganisationsEinheitIds(userResource);
......
...@@ -39,7 +39,7 @@ public class UserResourceTestFactory { ...@@ -39,7 +39,7 @@ public class UserResourceTestFactory {
return new UserResourceStub(attributes); return new UserResourceStub(attributes);
} }
public static UserResource createWithGroups(List<GroupRepresentation> groups) { public static UserResource createWithGroups(GroupRepresentation... groups) {
return new UserResourceStub(groups); return new UserResourceStub(List.of(groups));
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment