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

OZG-6897 clean up test

parent fc458932
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ import static org.mockito.Mockito.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
......@@ -66,7 +67,7 @@ class UserResourceMapperTest {
@Mock
RealmResource realm;
private UserResource userResource;
final Set<String> organisationsEinheitIds = Set.of(ORGANISATIONS_EINHEIT_ID_1);
@DisplayName("To kop user")
@Nested
......@@ -75,15 +76,8 @@ class UserResourceMapperTest {
@BeforeEach
void init() {
when(properties.ldapIdKey()).thenReturn("LDAP_ID");
when(properties.organisationsEinheitIdKey()).thenReturn("organisationseinheitId");
when(properties.client()).thenReturn("alfa");
when(realm.getGroupByPath(GROUP_1_PATH))
.thenReturn(GroupRepresentationTestFactory.createByPathAndOrganisationEinheitIds(GROUP_1_PATH, ORGANISATIONS_EINHEIT_ID_1));
when(properties.ldapIdKey()).thenReturn("LDAP_ID");
when(properties.organisationsEinheitIdKey()).thenReturn("organisationseinheitId");
when(properties.client()).thenReturn("alfa");
userResource = UserResourceTestFactory.create();
doReturn(organisationsEinheitIds).when(mapper).mapOrganisationsEinheitIds(any());
}
@Test
......@@ -142,9 +136,9 @@ class UserResourceMapperTest {
@Test
void shouldMapOrganisationsEinheitIds() {
toKopUser();
var result = toKopUser();
verify(mapper).mapOrganisationsEinheitIds(userResource);
assertThat(result.getOrganisationsEinheitIds()).hasSameElementsAs(organisationsEinheitIds);
}
@Test
......@@ -176,7 +170,7 @@ class UserResourceMapperTest {
}
private User toKopUser() {
return toKopUser(userResource);
return toKopUser(UserResourceTestFactory.create());
}
private User toKopUser(UserResource userResource) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment