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

Merge pull request 'OZG-6641 add depcrecated BayernId postfach (type=BayernId)...

Merge pull request 'OZG-6641 add depcrecated BayernId postfach (type=BayernId) to configuration' (#34) from OZG-6641-AdjustPostfachConfiguration into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-app/nachrichten-manager/pulls/34


Reviewed-by: default avatarOZGCloud <ozgcloud@mgm-tp.com>
parents 82a7d14e 379a4a8e
No related branches found
No related tags found
No related merge requests found
...@@ -230,7 +230,20 @@ class PostfachService { ...@@ -230,7 +230,20 @@ class PostfachService {
} }
public Stream<Postfach> getPostfachs() { public Stream<Postfach> getPostfachs() {
return isPostfachConfigured() ? Stream.of(buildPostfach(postfachRemoteService)) : Stream.empty(); return isPostfachConfigured() ? getPostfaecher() : Stream.empty();
}
private Stream<Postfach> getPostfaecher() {
var postfach = buildPostfach(postfachRemoteService);
// TODO Nach Umstellung auf BAYERN_ID entfernen
if (postfachRemoteService.getPostfachType().equals("BAYERN_ID")) {
return Stream.of(postfach, Postfach.builder()
.type("BayernId")
.isReplyAllowed(postfach.isReplyAllowed())
.build());
}
//
return Stream.of(postfach);
} }
Postfach buildPostfach(PostfachRemoteService postfachRemoteService) { Postfach buildPostfach(PostfachRemoteService postfachRemoteService) {
......
...@@ -733,6 +733,7 @@ class PostfachServiceTest { ...@@ -733,6 +733,7 @@ class PostfachServiceTest {
} }
} }
@DisplayName("Get postfachs")
@Nested @Nested
class TestGetPostfachs { class TestGetPostfachs {
...@@ -749,6 +750,7 @@ class PostfachServiceTest { ...@@ -749,6 +750,7 @@ class PostfachServiceTest {
@Test @Test
void shouldReturnPostfachs() { void shouldReturnPostfachs() {
when(postfachRemoteService.getPostfachType()).thenReturn(PostfachTestFactory.POSTFACH_TYPE);
doReturn(postfach).when(service).buildPostfach(any()); doReturn(postfach).when(service).buildPostfach(any());
var result = service.getPostfachs(); var result = service.getPostfachs();
...@@ -765,6 +767,45 @@ class PostfachServiceTest { ...@@ -765,6 +767,45 @@ class PostfachServiceTest {
assertThat(result).isEmpty(); assertThat(result).isEmpty();
} }
@DisplayName("on bayern id postfach")
@Nested
class TestOnBayernIdPostfach {
private static final String BAYERN_ID_POSTFACH = "BAYERN_ID";
private static final String DEPRECATED_BAYERN_ID_POSTFACH = "BayernId";
@BeforeEach
void mock() {
doReturn(true).when(service).isPostfachConfigured();
when(postfachRemoteService.getPostfachType()).thenReturn(BAYERN_ID_POSTFACH);
}
@Test
void shouldReturnTwoPostfach() {
var postfaecher = getPostfaecher();
assertThat(postfaecher).hasSize(2);
}
@Test
void shouldContainsBayernIdCamelCase() {
var postfaecher = getPostfaecher();
assertThat(postfaecher).extracting(Postfach::getType).contains(DEPRECATED_BAYERN_ID_POSTFACH);
}
@Test
void shouldContainsBayernIdUnderscore() {
var postfaecher = getPostfaecher();
assertThat(postfaecher).extracting(Postfach::getType).contains(BAYERN_ID_POSTFACH);
}
private Stream<Postfach> getPostfaecher() {
return service.getPostfachs();
}
}
@Nested @Nested
class TestBuildPostfach { class TestBuildPostfach {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment