From 9365b1bfbd46f4562551527f9aa0864637e04679 Mon Sep 17 00:00:00 2001 From: Slawomir Wieczorek Date: Thu, 19 Dec 2024 09:32:04 +0100 Subject: [PATCH] HELLODATA-1881 - fix tests --- .../dap/hellodata/portal/user/service/UserServiceTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hello-data-portal/hello-data-portal-api/src/test/java/ch/bedag/dap/hellodata/portal/user/service/UserServiceTest.java b/hello-data-portal/hello-data-portal-api/src/test/java/ch/bedag/dap/hellodata/portal/user/service/UserServiceTest.java index 8b660e47..1c00fd20 100644 --- a/hello-data-portal/hello-data-portal-api/src/test/java/ch/bedag/dap/hellodata/portal/user/service/UserServiceTest.java +++ b/hello-data-portal/hello-data-portal-api/src/test/java/ch/bedag/dap/hellodata/portal/user/service/UserServiceTest.java @@ -115,6 +115,7 @@ public void testCreateUser() { when(keycloakService.createUser(any())).thenReturn(createdUserId); when(userRepository.saveAndFlush(any(UserEntity.class))).thenReturn(new UserEntity()); when(userRepresentation.getEmail()).thenReturn("some_email@example.com"); + when(userRepresentation.getUsername()).thenReturn("username"); // when String result = userService.createUser(email, firstName, lastName); @@ -207,6 +208,7 @@ public void testDisableUserById_UserFound() { UserRepresentation userRepresentation = new UserRepresentation(); userRepresentation.setEnabled(true); userRepresentation.setEmail("some_email@example.com"); + userRepresentation.setUsername("username"); UserEntity userEntity = new UserEntity(); userEntity.setId(uuid); @@ -248,6 +250,7 @@ public void testEnableUserById_UserFound() { UserRepresentation userRepresentation = new UserRepresentation(); userRepresentation.setEnabled(false); userRepresentation.setEmail("some_email@example.com"); + userRepresentation.setUsername("username"); UserEntity userEntity = new UserEntity(); userEntity.setId(uuid); when(userRepository.getByIdOrAuthId(any(String.class))).thenReturn(userEntity);