Search in sources :

Example 6 with PermissionBO

use of com.nexblocks.authguard.service.model.PermissionBO in project AuthGuard by AuthGuard.

the class PermissionsServiceImplTest method getById.

@Test
void getById() {
    final PermissionDO permission = PermissionDO.builder().id("permission").group("test").name("read").build();
    final PermissionBO expected = PermissionBO.builder().id("permission").group("test").name("read").build();
    Mockito.when(permissionsRepository.getById(permission.getId())).thenReturn(CompletableFuture.completedFuture(Optional.of(permission)));
    final Optional<PermissionBO> actual = permissionsService.getById(permission.getId());
    assertThat(actual).contains(expected);
}
Also used : PermissionBO(com.nexblocks.authguard.service.model.PermissionBO) PermissionDO(com.nexblocks.authguard.dal.model.PermissionDO) Test(org.junit.jupiter.api.Test)

Example 7 with PermissionBO

use of com.nexblocks.authguard.service.model.PermissionBO in project AuthGuard by AuthGuard.

the class PermissionsServiceImplTest method delete.

@Test
void delete() {
    final PermissionDO permission = PermissionDO.builder().id("permission").group("test").name("read").build();
    final PermissionBO expected = PermissionBO.builder().id("permission").group("test").name("read").build();
    Mockito.when(permissionsRepository.delete(permission.getId())).thenReturn(CompletableFuture.completedFuture(Optional.of(permission)));
    final Optional<PermissionBO> actual = permissionsService.delete(permission.getId());
    assertThat(actual).contains(expected);
}
Also used : PermissionBO(com.nexblocks.authguard.service.model.PermissionBO) PermissionDO(com.nexblocks.authguard.dal.model.PermissionDO) Test(org.junit.jupiter.api.Test)

Aggregations

PermissionBO (com.nexblocks.authguard.service.model.PermissionBO)7 Test (org.junit.jupiter.api.Test)6 PermissionDO (com.nexblocks.authguard.dal.model.PermissionDO)3 AppDO (com.nexblocks.authguard.dal.model.AppDO)2 ApplicationsRepository (com.nexblocks.authguard.dal.persistence.ApplicationsRepository)2 MessageBus (com.nexblocks.authguard.emb.MessageBus)2 AccountsService (com.nexblocks.authguard.service.AccountsService)2 ApplicationsService (com.nexblocks.authguard.service.ApplicationsService)2 IdempotencyService (com.nexblocks.authguard.service.IdempotencyService)2 ServiceMapper (com.nexblocks.authguard.service.mappers.ServiceMapper)2 ServiceMapperImpl (com.nexblocks.authguard.service.mappers.ServiceMapperImpl)2 AccountBO (com.nexblocks.authguard.service.model.AccountBO)2 AppBO (com.nexblocks.authguard.service.model.AppBO)2 RequestContextBO (com.nexblocks.authguard.service.model.RequestContextBO)2 List (java.util.List)2 Optional (java.util.Optional)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 Supplier (java.util.function.Supplier)2 Collectors (java.util.stream.Collectors)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2