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

OZG-7350 rename method in CollaborationRequestMapper

parent 416c9304
Branches
Tags
No related merge requests found
...@@ -68,7 +68,7 @@ class CollaborationEventListener { ...@@ -68,7 +68,7 @@ class CollaborationEventListener {
} }
void createCollaborationRequest(Command command) { void createCollaborationRequest(Command command) {
var collaborationRequest = collaborationRequestMapper.toCollaborationRequest(command); var collaborationRequest = collaborationRequestMapper.toCollaborationRequestExcludingFachstelle(command);
switch (collaborationRequest.getCollaborationLevel()) { switch (collaborationRequest.getCollaborationLevel()) {
case 1 -> createLevel1CollaborationRequest(collaborationRequest, command); case 1 -> createLevel1CollaborationRequest(collaborationRequest, command);
case 4 -> createLevel4CollaborationRequest(collaborationRequest, command); case 4 -> createLevel4CollaborationRequest(collaborationRequest, command);
......
...@@ -73,7 +73,7 @@ public abstract class CollaborationRequestMapper { ...@@ -73,7 +73,7 @@ public abstract class CollaborationRequestMapper {
@Mapping(target = "titel", expression = "java(getStringProperty(CollaborationRequest.PROPERTY_TITEL, command.getBodyObject()))") @Mapping(target = "titel", expression = "java(getStringProperty(CollaborationRequest.PROPERTY_TITEL, command.getBodyObject()))")
@Mapping(target = "beschreibung", expression = "java(getStringProperty(CollaborationRequest.PROPERTY_BESCHREIBUNG, command.getBodyObject()))") @Mapping(target = "beschreibung", expression = "java(getStringProperty(CollaborationRequest.PROPERTY_BESCHREIBUNG, command.getBodyObject()))")
@Mapping(target = "collaborationLevel", expression = "java(getIntProperty(CollaborationRequest.PROPERTY_COLLABORATION_LEVEL, command.getBodyObject()))") @Mapping(target = "collaborationLevel", expression = "java(getIntProperty(CollaborationRequest.PROPERTY_COLLABORATION_LEVEL, command.getBodyObject()))")
public abstract CollaborationRequest toCollaborationRequest(Command command); public abstract CollaborationRequest toCollaborationRequestExcludingFachstelle(Command command);
@Mapping(target = "id", ignore = true) @Mapping(target = "id", ignore = true)
@Mapping(target = "status", ignore = true) @Mapping(target = "status", ignore = true)
......
...@@ -98,17 +98,17 @@ class CollaborationEventListenerTest { ...@@ -98,17 +98,17 @@ class CollaborationEventListenerTest {
@Test @Test
void shouldCallCommandMapper() { void shouldCallCommandMapper() {
when(commandMapper.toCollaborationRequest(any())).thenReturn(CollaborationRequestTestFactory.create()); when(commandMapper.toCollaborationRequestExcludingFachstelle(any())).thenReturn(CollaborationRequestTestFactory.create());
eventListener.createCollaborationRequest(command); eventListener.createCollaborationRequest(command);
verify(commandMapper).toCollaborationRequest(command); verify(commandMapper).toCollaborationRequestExcludingFachstelle(command);
} }
@Test @Test
void shouldCallCreateLevel1CollaborationRequest() { void shouldCallCreateLevel1CollaborationRequest() {
var collaborationRequest = CollaborationRequestTestFactory.create(); var collaborationRequest = CollaborationRequestTestFactory.create();
when(commandMapper.toCollaborationRequest(any())).thenReturn(collaborationRequest); when(commandMapper.toCollaborationRequestExcludingFachstelle(any())).thenReturn(collaborationRequest);
eventListener.createCollaborationRequest(command); eventListener.createCollaborationRequest(command);
...@@ -118,7 +118,7 @@ class CollaborationEventListenerTest { ...@@ -118,7 +118,7 @@ class CollaborationEventListenerTest {
@Test @Test
void shouldCallCreateLevel4CollaborationRequest() { void shouldCallCreateLevel4CollaborationRequest() {
var collaborationRequest = CollaborationRequestTestFactory.createBuilder().collaborationLevel(4).build(); var collaborationRequest = CollaborationRequestTestFactory.createBuilder().collaborationLevel(4).build();
when(commandMapper.toCollaborationRequest(any())).thenReturn(collaborationRequest); when(commandMapper.toCollaborationRequestExcludingFachstelle(any())).thenReturn(collaborationRequest);
eventListener.createCollaborationRequest(command); eventListener.createCollaborationRequest(command);
...@@ -130,7 +130,7 @@ class CollaborationEventListenerTest { ...@@ -130,7 +130,7 @@ class CollaborationEventListenerTest {
@ValueSource(ints = { 0, 2, 3, 5 }) @ValueSource(ints = { 0, 2, 3, 5 })
void shouldDeclineRequest(int collaborationLevel) { void shouldDeclineRequest(int collaborationLevel) {
var collaborationRequest = CollaborationRequestTestFactory.createBuilder().collaborationLevel(collaborationLevel).build(); var collaborationRequest = CollaborationRequestTestFactory.createBuilder().collaborationLevel(collaborationLevel).build();
when(commandMapper.toCollaborationRequest(any())).thenReturn(collaborationRequest); when(commandMapper.toCollaborationRequestExcludingFachstelle(any())).thenReturn(collaborationRequest);
eventListener.createCollaborationRequest(command); eventListener.createCollaborationRequest(command);
......
...@@ -70,7 +70,7 @@ class CollaborationRequestMapperTest { ...@@ -70,7 +70,7 @@ class CollaborationRequestMapperTest {
private FachstelleMapper fachstelleMapper; private FachstelleMapper fachstelleMapper;
@Nested @Nested
class TestToCreateCollaborationRequest { class TestToCollaborationRequestExcludingFachstelle {
private static final Map<String, Object> BODY_OBJECT = Map.of( private static final Map<String, Object> BODY_OBJECT = Map.of(
CollaborationRequest.PROPERTY_TITEL, CollaborationRequestTestFactory.TITEL, CollaborationRequest.PROPERTY_TITEL, CollaborationRequestTestFactory.TITEL,
...@@ -84,7 +84,7 @@ class CollaborationRequestMapperTest { ...@@ -84,7 +84,7 @@ class CollaborationRequestMapperTest {
@Test @Test
void shouldMapCommand() { void shouldMapCommand() {
var result = mapper.toCollaborationRequest(COMMAND); var result = mapper.toCollaborationRequestExcludingFachstelle(COMMAND);
assertThat(result).usingRecursiveComparison() assertThat(result).usingRecursiveComparison()
.ignoringFields("id", "createdBy", "collaborationVorgangId", "zustaendigeStelle") .ignoringFields("id", "createdBy", "collaborationVorgangId", "zustaendigeStelle")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment