Skip to content

Commit

Permalink
Merge pull request #883 from alphagov/PP-6850-add-missing-transaction…
Browse files Browse the repository at this point in the history
…dao-test

PP-6850 Add TransactionDao test
  • Loading branch information
stephencdaly authored Aug 12, 2020
2 parents c5e6787 + 915385f commit d8f3aa8
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,31 @@ public void findTransactionByParentIdAndGatewayAccountId_shouldFilterByParentExt
TransactionEntity transactionEntity = transactionEntityList.get(0);

assertThat(transactionEntity.getId(), is(transactionWithParentExternalId.getId()));
}

@Test
public void findTransactionByParentId_shouldFilterByParentExternalId() {
TransactionEntity transaction1 = aTransactionFixture()
.withState(TransactionState.CREATED)
.withTransactionType("PAYMENT")
.insert(rule.getJdbi())
.toEntity();

TransactionEntity transactionWithParentExternalId = aTransactionFixture()
.withState(TransactionState.SUBMITTED)
.withTransactionType("REFUND")
.withGatewayAccountId(transaction1.getGatewayAccountId())
.withParentExternalId(transaction1.getExternalId())
.insert(rule.getJdbi())
.toEntity();

List<TransactionEntity> transactionEntityList =
transactionDao.findTransactionByParentId(transactionWithParentExternalId.getParentExternalId());

assertThat(transactionEntityList.size(), is(1));
TransactionEntity transactionEntity = transactionEntityList.get(0);

assertThat(transactionEntity.getId(), is(transactionWithParentExternalId.getId()));
}

@Test
Expand Down

0 comments on commit d8f3aa8

Please sign in to comment.