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

OZG-4994 OZG-5066 improve tests

parent 7ea0ae70
Branches
Tags
No related merge requests found
...@@ -188,10 +188,22 @@ class StatisticServiceTest { ...@@ -188,10 +188,22 @@ class StatisticServiceTest {
@Nested @Nested
class TestGetVorgaengeStatistics { class TestGetVorgaengeStatistics {
private final Statistic statistic = StatisticTestFactory.create();
private final Map<String, StatisticResult> getVorgangStatisticsResponse = Map.of(COUNT_WIEDERVORLAGE_NEXT_FRIST_RESULT_NAME,
StatisticResultTestFactory.create());
@BeforeEach @BeforeEach
void beforeEach() { void beforeEach() {
when(remoteService.buildCountByStatusResultName(any())).thenCallRealMethod();
doReturn(COUNT_BY_VORGANG_STATUS_VERWALTUNG_USER).when(service).getCountByVorgangStatusList(); doReturn(COUNT_BY_VORGANG_STATUS_VERWALTUNG_USER).when(service).getCountByVorgangStatusList();
when(remoteService.getVorgaengeStatistics(COUNT_BY_VORGANG_STATUS_VERWALTUNG_USER)).thenReturn(getVorgangStatisticsResponse);
doReturn(statistic).when(service).buildGetVorgaengeStatisticResult(getVorgangStatisticsResponse);
}
@Test
void shouldCallGetCountByVorgangStatusList() {
service.getVorgaengeStatistic();
verify(service).getCountByVorgangStatusList();
} }
@Test @Test
...@@ -203,19 +215,16 @@ class StatisticServiceTest { ...@@ -203,19 +215,16 @@ class StatisticServiceTest {
@Test @Test
void shouldBuildResult() { void shouldBuildResult() {
var response = Map.of(COUNT_WIEDERVORLAGE_NEXT_FRIST_RESULT_NAME, StatisticResultTestFactory.create());
when(remoteService.getVorgaengeStatistics(COUNT_BY_VORGANG_STATUS_VERWALTUNG_USER)).thenReturn(response);
service.getVorgaengeStatistic(); service.getVorgaengeStatistic();
verify(service).buildGetVorgaengeStatisticResult(response); verify(service).buildGetVorgaengeStatisticResult(getVorgangStatisticsResponse);
} }
@Test @Test
void shouldCallGetCountByVorgangStatusList() { void shouldReturnStatistic() {
service.getVorgaengeStatistic(); var result = service.getVorgaengeStatistic();
verify(service).getCountByVorgangStatusList(); assertThat(result).isEqualTo(statistic);
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment