Skip to content
Snippets Groups Projects
Commit b57753e7 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6867 Rename method getAttributes()

parent e0e6524a
No related branches found
No related tags found
No related merge requests found
......@@ -49,10 +49,10 @@ abstract class GroupMapper {
return values.getFirst();
}
@Mapping(target = "attributes", expression = "java(getAttributes(groupToAdd))")
@Mapping(target = "attributes", expression = "java(buildGroupAttributes(groupToAdd))")
public abstract GroupRepresentation toGroupRepresentation(AddGroupData groupToAdd);
Map<String, List<String>> getAttributes(AddGroupData groupToAdd) {
Map<String, List<String>> buildGroupAttributes(AddGroupData groupToAdd) {
var organisationsEinheitId = groupToAdd.getOrganisationsEinheitId();
return StringUtils.isNotBlank(organisationsEinheitId) ?
Map.of(keycloakApiProperties.getOrganisationsEinheitIdKey(), List.of(organisationsEinheitId)) :
......
......@@ -253,7 +253,7 @@ class GroupMapperTest {
@BeforeEach
void init() {
doReturn(ATTRIBUTES).when(mapper).getAttributes(addGroupData);
doReturn(ATTRIBUTES).when(mapper).buildGroupAttributes(addGroupData);
}
@Test
......@@ -271,10 +271,10 @@ class GroupMapperTest {
}
@Test
void shouldGetAttributes() {
void shouldBuildGroupAttributes() {
callMapper();
verify(mapper).getAttributes(addGroupData);
verify(mapper).buildGroupAttributes(addGroupData);
}
@Test
......@@ -290,14 +290,14 @@ class GroupMapperTest {
}
@Nested
class TestGetAttributes {
class TestBuildGroupAttributes {
@ParameterizedTest
@NullAndEmptySource
void shouldReturnEmptyMap(String organisationsEinheitId) {
var addGroupData = AddGroupDataTestFactory.createBuilder().organisationsEinheitId(organisationsEinheitId).build();
var attributes = mapper.getAttributes(addGroupData);
var attributes = mapper.buildGroupAttributes(addGroupData);
assertThat(attributes).isEmpty();
}
......@@ -306,7 +306,7 @@ class GroupMapperTest {
void shouldAddOrganisationsEinheitIdToAttributes() {
givenOrganisationsEinheitIdProperty();
var attributes = mapper.getAttributes(AddGroupDataTestFactory.create());
var attributes = mapper.buildGroupAttributes(AddGroupDataTestFactory.create());
assertThat(attributes).hasSize(1).containsEntry(ORGANIZATIONS_EINHEIT_ID_ATTRIBUTE, List.of(GroupTestFactory.ORGANISATIONS_EINHEIT_ID));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment