@Test
public void mergesDetailsForTransfer() throws Exception {
final ByteArrayInputStream inputStream = new ByteArrayInputStream("".getBytes());
final Account transferAccount = new Account(-1L, "transfer account");
when(importFile.parse(inputStream)).thenReturn(Arrays.asList(
ImmutableListMultimap.of(dateField, "01/15/1990", amountField, "10", transferField, TRANSFER_ACCOUNT),
ImmutableListMultimap.of(dateField, "01/15/1990", amountField, "1", transferField, TRANSFER_ACCOUNT)));
ImportContext context = new GroupedDetailImportContext(importFile, payeeMapper, securityMapper, categoryMapper);
when(importFile.getTransferAccount(TRANSFER_ACCOUNT)).thenReturn(transferAccount);
List<Transaction> transactions = context.parseTransactions(inputStream);
assertThat(transactions).hasSize(1);
assertThat(transactions.get(0).getDetails()).hasSize(1);
assertThat(transactions.get(0).getDetails().get(0).getCategory()).isNull();
assertThat(transactions.get(0).getDetails().get(0).getTransferAccount()).isSameAs(transferAccount);
assertThat(transactions.get(0).getDetails().get(0).getAmount().toString()).isEqualTo("11");
}
GroupedDetailImportContextTest.java 文件源码
java
阅读 32
收藏 0
点赞 0
评论 0
项目:finances
作者:
评论列表
文章目录