Search in sources :

Example 1 with AppDO

use of com.nexblocks.authguard.dal.model.AppDO in project AuthGuard by AuthGuard.

the class ApplicationsServiceImplTest method deactivate.

@Test
void deactivate() {
    final AppDO app = random.nextObject(AppDO.class);
    app.setActive(true);
    Mockito.when(applicationsRepository.getById(app.getId())).thenReturn(CompletableFuture.completedFuture(Optional.of(app)));
    Mockito.when(applicationsRepository.update(any())).thenAnswer(invocation -> CompletableFuture.completedFuture(Optional.of(invocation.getArgument(0, AppDO.class))));
    final AppBO updated = applicationsService.deactivate(app.getId()).orElse(null);
    assertThat(updated).isNotNull();
    assertThat(updated.isActive()).isFalse();
}
Also used : AppDO(com.nexblocks.authguard.dal.model.AppDO) AppBO(com.nexblocks.authguard.service.model.AppBO) Test(org.junit.jupiter.api.Test)

Example 2 with AppDO

use of com.nexblocks.authguard.dal.model.AppDO in project AuthGuard by AuthGuard.

the class ApplicationsServiceImplTest method activate.

@Test
void activate() {
    final AppDO app = random.nextObject(AppDO.class);
    app.setActive(false);
    Mockito.when(applicationsRepository.getById(app.getId())).thenReturn(CompletableFuture.completedFuture(Optional.of(app)));
    Mockito.when(applicationsRepository.update(any())).thenAnswer(invocation -> CompletableFuture.completedFuture(Optional.of(invocation.getArgument(0, AppDO.class))));
    final AppBO updated = applicationsService.activate(app.getId()).orElse(null);
    assertThat(updated).isNotNull();
    assertThat(updated.isActive()).isTrue();
}
Also used : AppDO(com.nexblocks.authguard.dal.model.AppDO) AppBO(com.nexblocks.authguard.service.model.AppBO) Test(org.junit.jupiter.api.Test)

Example 3 with AppDO

use of com.nexblocks.authguard.dal.model.AppDO in project AuthGuard by AuthGuard.

the class ApplicationsServiceImplTest method delete.

@Test
void delete() {
    final AppDO app = random.nextObject(AppDO.class);
    app.setDeleted(false);
    Mockito.when(applicationsRepository.delete(app.getId())).thenReturn(CompletableFuture.completedFuture(Optional.of(app)));
    applicationsService.delete(app.getId());
    Mockito.verify(applicationsRepository).delete(app.getId());
}
Also used : AppDO(com.nexblocks.authguard.dal.model.AppDO) Test(org.junit.jupiter.api.Test)

Aggregations

AppDO (com.nexblocks.authguard.dal.model.AppDO)3 Test (org.junit.jupiter.api.Test)3 AppBO (com.nexblocks.authguard.service.model.AppBO)2