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

OZG-6867 Added missing unit test

parent b57753e7
Branches
Tags
No related merge requests found
...@@ -3,6 +3,8 @@ package de.ozgcloud.admin.keycloak; ...@@ -3,6 +3,8 @@ package de.ozgcloud.admin.keycloak;
import static org.assertj.core.api.Assertions.*; import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;
import java.util.List;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -26,6 +28,27 @@ class KeycloakApiServiceTest { ...@@ -26,6 +28,27 @@ class KeycloakApiServiceTest {
@Mock @Mock
private Response response; private Response response;
@Nested
class TestGetAllGroups {
@Test
void shouldCallGroupsResource() {
service.getAllGroups();
verify(groupsResource).groups("", 0, Integer.MAX_VALUE, false);
}
@Test
void shouldReturnGroupRepresentations() {
var groupRepresentation = GroupRepresentationTestFactory.create();
when(groupsResource.groups("", 0, Integer.MAX_VALUE, false)).thenReturn(List.of(groupRepresentation));
var gotGroupRepresentations = service.getAllGroups();
assertThat(gotGroupRepresentations).containsExactly(groupRepresentation);
}
}
@Nested @Nested
class TestAddGroup { class TestAddGroup {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment