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

OZG-4870 format realmMapperTest

parent 77547481
Branches
Tags
No related merge requests found
......@@ -25,8 +25,6 @@ package de.ozgcloud.operator.keycloak.realm;
import static org.assertj.core.api.Assertions.*;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.mapstruct.factory.Mappers;
import org.mockito.Spy;
......@@ -102,25 +100,22 @@ class KeycloakRealmMapperTest {
@Test
void shouldContainSmtpServerKeysValues() {
var mapped = mapper.map(OzgCloudKeycloakRealmSpecTestFactory.create());
var mappedSmtpServer = mapped.getSmtpServer();
assertThat(Map.of(mappedSmtpServer.get("host"), KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_HOST));
assertThat(Map.of(mappedSmtpServer.get("port"), KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_PORT));
assertThat(Map.of(mappedSmtpServer.get("password"), KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_PASSWORD));
assertThat(Map.of(mappedSmtpServer.get("user"), KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_USER));
assertThat(Map.of(mappedSmtpServer.get("starttls"), KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_STARTTLS));
assertThat(Map.of(mappedSmtpServer.get("auth"), KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_AUTH));
assertThat(Map.of(mappedSmtpServer.get("from"), KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_FROM));
assertThat(Map.of(mappedSmtpServer.get("fromDisplayName"), KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_FROM_DISPLAY_NAME));
assertThat(mapped.getSmtpServer())
.containsEntry("user", KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_USER)
.containsEntry("password", KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_PASSWORD)
.containsEntry("host", KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_HOST)
.containsEntry("port", KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_PORT)
.containsEntry("starttls", KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_STARTTLS)
.containsEntry("auth", KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_AUTH)
.containsEntry("from", KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_FROM)
.containsEntry("fromDisplayName", KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_FROM_DISPLAY_NAME);
}
@Test
void shouldMapWhenSmtpServerIsNull() {
var mapped = mapper.map(OzgCloudKeycloakRealmSpecTestFactory.createBuilder().smtpServer(null).build());
assertThat(mapped.getSmtpServer()).isEmpty();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment