use of com.forgerock.openbanking.common.model.data.FRAccountData in project openbanking-aspsp by OpenBankingToolkit.
the class DataCreatorTest method createStatementsShouldAllowCreateWhenOnLimit.
@Test
public void createStatementsShouldAllowCreateWhenOnLimit() {
// Given
String accountId = "1";
OBStatement2 statement = new OBStatement2().accountId(accountId).statementId("2");
FRAccountData accountData = new FRAccountData().addStatement(statement);
accountData.setAccount(new OBAccount6().accountId(accountId));
given(statementRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(999L);
// When
dataCreator.createStatements(accountData, Collections.singleton("1"));
// Then
ArgumentCaptor<List<FRStatement>> argumentCaptor = ArgumentCaptor.forClass(List.class);
verify(statementRepository).saveAll(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().get(0).getAccountId()).isEqualTo(accountId);
}
use of com.forgerock.openbanking.common.model.data.FRAccountData in project openbanking-aspsp by OpenBankingToolkit.
the class DataCreatorTest method createDirectDebitsShouldThrowExceptionForExceedingLimit.
@Test
public void createDirectDebitsShouldThrowExceptionForExceedingLimit() {
// Given
String accountId = "1";
FRAccountData accountData = new FRAccountData().addDirectDebit(new OBReadDirectDebit2DataDirectDebit().accountId(accountId));
accountData.setAccount(new OBAccount6().accountId(accountId));
given(directDebitRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(1000L);
assertThatThrownBy(// When
() -> dataCreator.createDirectDebits(accountData, Collections.singleton("1"))).satisfies(t -> assertThat(((ResponseStatusException) t).getStatus()).isEqualTo(HttpStatus.PAYLOAD_TOO_LARGE));
}
use of com.forgerock.openbanking.common.model.data.FRAccountData in project openbanking-aspsp by OpenBankingToolkit.
the class DataCreatorTest method createScheduledPaymentsShouldThrowExceptionForExceedingLimit.
@Test
public void createScheduledPaymentsShouldThrowExceptionForExceedingLimit() {
// Given
String accountId = "1";
FRAccountData accountData = new FRAccountData().addScheduledPayment(new OBScheduledPayment3().accountId(accountId));
accountData.setAccount(new OBAccount6().accountId(accountId));
given(scheduledPaymentRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(1000L);
assertThatThrownBy(// When
() -> dataCreator.createScheduledPayments(accountData, Collections.singleton("1"))).satisfies(t -> assertThat(((ResponseStatusException) t).getStatus()).isEqualTo(HttpStatus.PAYLOAD_TOO_LARGE));
}
use of com.forgerock.openbanking.common.model.data.FRAccountData in project openbanking-aspsp by OpenBankingToolkit.
the class DataCreatorTest method createOffersShouldThrowExceptionForExceedingLimit.
@Test
public void createOffersShouldThrowExceptionForExceedingLimit() {
// Given
String accountId = "1";
FRAccountData accountData = new FRAccountData().addOffer(new OBOffer1().accountId(accountId));
accountData.setAccount(new OBAccount6().accountId(accountId));
given(offerRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(1000L);
assertThatThrownBy(// When
() -> dataCreator.createOffers(accountData, Collections.singleton("1"))).satisfies(t -> assertThat(((ResponseStatusException) t).getStatus()).isEqualTo(HttpStatus.PAYLOAD_TOO_LARGE));
}
use of com.forgerock.openbanking.common.model.data.FRAccountData in project openbanking-aspsp by OpenBankingToolkit.
the class DataCreatorTest method createDirectDebitsShouldAllowCreateWhenOnLimit.
@Test
public void createDirectDebitsShouldAllowCreateWhenOnLimit() {
// Given
String accountId = "1";
OBReadDirectDebit2DataDirectDebit directDebit = new OBReadDirectDebit2DataDirectDebit().accountId(accountId).directDebitId("2");
FRAccountData accountData = new FRAccountData().addDirectDebit(directDebit);
accountData.setAccount(new OBAccount6().accountId(accountId));
given(directDebitRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(999L);
// When
dataCreator.createDirectDebits(accountData, Collections.singleton("1"));
// Then
ArgumentCaptor<List<FRDirectDebit>> argumentCaptor = ArgumentCaptor.forClass(List.class);
verify(directDebitRepository).saveAll(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().get(0).getAccountId()).isEqualTo(accountId);
}
Aggregations