use of com.nexblocks.authguard.service.model.ExchangeAttemptBO in project AuthGuard by AuthGuard.
the class ExchangeAttemptsServiceImplTest method findByEntityIdAndFromTimestampAndExchange.
@Test
void findByEntityIdAndFromTimestampAndExchange() {
final OffsetDateTime now = OffsetDateTime.now();
final ExchangeAttemptsQueryBO query = ExchangeAttemptsQueryBO.builder().entityId("account").fromTimestamp(now).fromExchange("basic").build();
Mockito.when(repository.findByEntityAndTimestampAndExchange("account", now, "basic")).thenReturn(CompletableFuture.completedFuture(Collections.singletonList(ExchangeAttemptDO.builder().entityId("account").exchangeFrom("basic").exchangeTo("session").build())));
final Collection<ExchangeAttemptBO> actual = service.find(query);
final Collection<ExchangeAttemptBO> expected = Collections.singletonList(ExchangeAttemptBO.builder().entityId("account").exchangeFrom("basic").exchangeTo("session").build());
assertThat(actual).isEqualTo(expected);
}
use of com.nexblocks.authguard.service.model.ExchangeAttemptBO in project AuthGuard by AuthGuard.
the class ExchangeAttemptsServiceImplTest method findByEntityIdAndFromTimestamp.
@Test
void findByEntityIdAndFromTimestamp() {
final OffsetDateTime now = OffsetDateTime.now();
final ExchangeAttemptsQueryBO query = ExchangeAttemptsQueryBO.builder().entityId("account").fromTimestamp(now).build();
Mockito.when(repository.findByEntityAndTimestamp("account", now)).thenReturn(CompletableFuture.completedFuture(Collections.singletonList(ExchangeAttemptDO.builder().entityId("account").exchangeFrom("basic").exchangeTo("session").build())));
final Collection<ExchangeAttemptBO> actual = service.find(query);
final Collection<ExchangeAttemptBO> expected = Collections.singletonList(ExchangeAttemptBO.builder().entityId("account").exchangeFrom("basic").exchangeTo("session").build());
assertThat(actual).isEqualTo(expected);
}
use of com.nexblocks.authguard.service.model.ExchangeAttemptBO in project AuthGuard by AuthGuard.
the class ExchangeAttemptsServiceImplTest method findByEntityId.
@Test
void findByEntityId() {
final ExchangeAttemptsQueryBO query = ExchangeAttemptsQueryBO.builder().entityId("account").build();
Mockito.when(repository.findByEntity("account")).thenReturn(CompletableFuture.completedFuture(Collections.singletonList(ExchangeAttemptDO.builder().entityId("account").exchangeFrom("basic").exchangeTo("session").build())));
final Collection<ExchangeAttemptBO> actual = service.find(query);
final Collection<ExchangeAttemptBO> expected = Collections.singletonList(ExchangeAttemptBO.builder().entityId("account").exchangeFrom("basic").exchangeTo("session").build());
assertThat(actual).isEqualTo(expected);
}
Aggregations