use of uk.gov.pay.adminusers.model.StripeAgreement in project pay-adminusers by alphagov.
the class StripeAgreementServiceTest method shouldReturnStripeAgreement.
@Test
public void shouldReturnStripeAgreement() {
String serviceExternalId = "abc123";
String ipAddress = "192.0.2.0";
ZonedDateTime agreementTime = ZonedDateTime.now();
ServiceEntity mockServiceEntity = mock(ServiceEntity.class);
StripeAgreementEntity stripeAgreementEntity = new StripeAgreementEntity(mockServiceEntity, ipAddress, agreementTime);
when(mockedStripeAgreementDao.findByServiceExternalId(serviceExternalId)).thenReturn(Optional.of(stripeAgreementEntity));
Optional<StripeAgreement> maybeStripeAgreement = stripeAgreementService.findStripeAgreementByServiceId(serviceExternalId);
assertTrue(maybeStripeAgreement.isPresent());
assertThat(maybeStripeAgreement.get().getIpAddress().getHostAddress(), is(ipAddress));
assertThat(maybeStripeAgreement.get().getAgreementTime(), is(agreementTime));
}
Aggregations