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();
}
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();
}
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());
}