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

OZG-6867 add missing tests

parent 7d2be7a7
No related branches found
No related tags found
No related merge requests found
......@@ -206,8 +206,9 @@ class SyncServiceTest {
@BeforeEach
void setUp() {
doReturn(OrganisationsEinheitTestFactory.NAME).when(service).syncName(anyList(), any());
doReturn(SyncResult.OK).when(service).evaluateSyncResult(anyList(), any());
doReturn(syncedName).when(service).syncName(List.of(pvogOrganisationsEinheit), group.getSubGroups().getFirst());
doReturn(syncedSyncResult).when(service).evaluateSyncResult(List.of(pvogOrganisationsEinheit), group.getSubGroups().getFirst());
doReturn(syncedZufiId).when(service).syncZufiId(List.of(pvogOrganisationsEinheit));
when(organisationsEinheitRemoteService.getByOrganisationsEinheitId(GroupTestFactory.SUB_GROUP_ORGANISATIONS_EINHEIT_ID)).thenReturn(
List.of(pvogOrganisationsEinheit));
}
......@@ -221,23 +222,26 @@ class SyncServiceTest {
@Test
void shouldSyncName() {
service.syncGroup(group.getSubGroups().getFirst(), parent, syncTimestamp);
var synced = service.syncGroup(group.getSubGroups().getFirst(), parent, syncTimestamp);
verify(service).syncName(List.of(pvogOrganisationsEinheit), group.getSubGroups().getFirst());
assertThat(synced.getName()).isEqualTo(syncedName);
}
@Test
void shouldEvaluateSyncResult() {
service.syncGroup(group.getSubGroups().getFirst(), parent, syncTimestamp);
var synced = service.syncGroup(group.getSubGroups().getFirst(), parent, syncTimestamp);
verify(service).evaluateSyncResult(List.of(pvogOrganisationsEinheit), group.getSubGroups().getFirst());
assertThat(synced.getSyncResult()).isEqualTo(syncedSyncResult);
}
@Test
void shouldGetOrganisationsEinheit() {
service.syncGroup(group.getSubGroups().getFirst(), parent, syncTimestamp);
var synced = service.syncGroup(group.getSubGroups().getFirst(), parent, syncTimestamp);
verify(organisationsEinheitRemoteService).getByOrganisationsEinheitId(GroupTestFactory.SUB_GROUP_ORGANISATIONS_EINHEIT_ID);
assertThat(synced.getOrganisationsEinheitId()).isEqualTo(group.getSubGroups().getFirst().getOrganisationsEinheitId());
}
@Test
......@@ -249,9 +253,10 @@ class SyncServiceTest {
@Test
void shouldSyncZufiId() {
service.syncGroup(group.getSubGroups().getFirst(), parent, syncTimestamp);
var synced = service.syncGroup(group.getSubGroups().getFirst(), parent, syncTimestamp);
verify(service).syncZufiId(List.of(pvogOrganisationsEinheit));
assertThat(synced.getZufiId()).isEqualTo(syncedZufiId);
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment