From d1645306d35f45cc5ddc7c11ebcb73ce8aa8e974 Mon Sep 17 00:00:00 2001 From: Erling Jahr Date: Thu, 5 Oct 2023 14:57:14 +0200 Subject: [PATCH] added test for converting externaluser to user --- .../externalUser/ExternalUserServiceTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/test/java/no/fintlabs/externalUser/ExternalUserServiceTest.java diff --git a/src/test/java/no/fintlabs/externalUser/ExternalUserServiceTest.java b/src/test/java/no/fintlabs/externalUser/ExternalUserServiceTest.java new file mode 100644 index 0000000..22c2a5c --- /dev/null +++ b/src/test/java/no/fintlabs/externalUser/ExternalUserServiceTest.java @@ -0,0 +1,36 @@ +package no.fintlabs.externalUser; + +import no.fintlabs.user.User; +import org.junit.jupiter.api.Test; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.*; + +class ExternalUserServiceTest { + private ExternalUserService externalUserService; + + @Test + public void shouldReturnUser() { + ExternalUser externalUser = ExternalUser + .builder() + .userName("titten@tei.no") + .identityProviderUserObjectId(UUID.fromString("f37f3048-637a-11ee-8c99-0242ac120002")) + .userType("EXTERNAL") + .build(); + + User userToBeConverted = User + .builder() + .userName("titten@tei.no") + .identityProviderUserObjectId(UUID.fromString("f37f3048-637a-11ee-8c99-0242ac120002")) + .userType("EXTERNAL") + .resourceId("f37f3048-637a-11ee-8c99-0242ac120002") + .build(); + + User convertedUser = externalUser.toUser(); + + assertEquals(userToBeConverted.getResourceId(),convertedUser.getResourceId()); + } + + +} \ No newline at end of file