use of com.forgerock.openbanking.common.model.data.FRAccountData in project openbanking-aspsp by OpenBankingToolkit.
the class DataCreatorTest method createBeneficiariesShouldAllowCreateWhenOnLimit.
@Test
public void createBeneficiariesShouldAllowCreateWhenOnLimit() {
// Given
String accountId = "1";
OBBeneficiary5 beneficiary = new OBBeneficiary5().beneficiaryId("2").accountId(accountId);
FRAccountData accountData = new FRAccountData().addBeneficiary(beneficiary);
accountData.setAccount(new OBAccount6().accountId(accountId));
given(beneficiaryRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(999L);
// When
dataCreator.createBeneficiaries(accountData, Collections.singleton("1"));
// Then
ArgumentCaptor<List<FRBeneficiary>> argumentCaptor = ArgumentCaptor.forClass(List.class);
verify(beneficiaryRepository).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 createTransactionsShouldAllowCreateWhenOnLimit.
@Test
public void createTransactionsShouldAllowCreateWhenOnLimit() {
// Given
String accountId = "1";
OBTransaction6 transaction = new OBTransaction6().transactionId("2").accountId(accountId);
FRAccountData accountData = new FRAccountData().addTransaction(transaction);
accountData.setAccount(new OBAccount6().accountId(accountId));
given(transactionRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(999L);
// When
dataCreator.createTransactions(accountData, Collections.singleton("1"));
// Then
ArgumentCaptor<List<FRTransaction>> argumentCaptor = ArgumentCaptor.forClass(List.class);
verify(transactionRepository).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 createStatementsShouldThrowExceptionForExceedingLimit.
@Test
public void createStatementsShouldThrowExceptionForExceedingLimit() {
// Given
String accountId = "1";
FRAccountData accountData = new FRAccountData().addStatement(new OBStatement2().accountId(accountId));
accountData.setAccount(new OBAccount6().accountId(accountId));
given(statementRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(1000L);
assertThatThrownBy(// When
() -> dataCreator.createStatements(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 createScheduledPaymentsShouldAllowCreateWhenOnLimit.
@Test
public void createScheduledPaymentsShouldAllowCreateWhenOnLimit() {
// Given
String accountId = "1";
OBScheduledPayment3 scheduledPayment = new OBScheduledPayment3().accountId(accountId).scheduledPaymentId("2");
FRAccountData accountData = new FRAccountData().addScheduledPayment(scheduledPayment);
accountData.setAccount(new OBAccount6().accountId(accountId));
given(scheduledPaymentRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(999L);
// When
dataCreator.createScheduledPayments(accountData, Collections.singleton("1"));
// Then
ArgumentCaptor<List<FRScheduledPayment>> argumentCaptor = ArgumentCaptor.forClass(List.class);
verify(scheduledPaymentRepository).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 createTransactionsShouldThrowExceptionForExceedingLimit.
@Test
public void createTransactionsShouldThrowExceptionForExceedingLimit() {
// Given
String accountId = "1";
FRAccountData accountData = new FRAccountData().addTransaction(new OBTransaction6().accountId(accountId));
accountData.setAccount(new OBAccount6().accountId(accountId));
given(transactionRepository.countByAccountIdIn(Collections.singleton(accountId))).willReturn(1000L);
assertThatThrownBy(// When
() -> dataCreator.createTransactions(accountData, Collections.singleton("1"))).satisfies(t -> assertThat(((ResponseStatusException) t).getStatus()).isEqualTo(HttpStatus.PAYLOAD_TOO_LARGE));
}
Aggregations