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

OZG-5400 add unittest realm update

parent 256633ed
Branches
Tags
No related merge requests found
......@@ -43,6 +43,7 @@ import org.keycloak.admin.client.resource.RealmsResource;
import org.keycloak.admin.client.resource.RolesResource;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.representations.idm.GroupRepresentation;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.representations.idm.RoleRepresentation;
import org.mockito.InjectMocks;
import org.mockito.Mock;
......@@ -81,6 +82,8 @@ class KeycloakGenericRemoteServiceTest {
private RolesResource rolesResource;
@Mock
private RoleRepresentation roleRepresentation;
@Mock
private RealmRepresentation realmRepresentation;
@Nested
class TestGetKeycloakClientById {
......@@ -189,4 +192,19 @@ class KeycloakGenericRemoteServiceTest {
() -> service.getClientRole(UserRepresentationTestFactory.ROLE1, REAL_CLIENT_ID, REALM));
}
}
@Nested
class TestGetRealmRepresentation {
@BeforeEach
void init() {
when(keycloak.realm(REALM)).thenReturn(realmResource);
when(realmResource.toRepresentation()).thenReturn(realmRepresentation);
}
@Test
void shouldGetClientFromKeycloak() {
assertThat(Optional.of(keycloak.realm(REALM).toRepresentation())).isNotEmpty().contains(realmRepresentation);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment