Skip to content

Instantly share code, notes, and snippets.

@NIA
Created March 13, 2011 15:23
Show Gist options
  • Select an option

  • Save NIA/868170 to your computer and use it in GitHub Desktop.

Select an option

Save NIA/868170 to your computer and use it in GitHub Desktop.
Мне самому не нравятся такие тесты, но...?
@Test
public void testAccountsInitialization() {
AccountTree.Account expenses;
assertNotNull( expenses = findAccount("expenses", journal.getRootAccounts()) );
assertNotNull( findAccount("food", expenses.getChildren()) );
}
@Test
public void testTransactionsInitialization() throws Exception {
List<Transaction> ts = journal.getTransactions();
Transaction t;
assertNotNull(t = findByDateAndDesc("3-13", "first transaction"));
Map<AccountTree.Account,BigDecimal> postings = t.getPostings();
AccountTree.Account[] accounts = new AccountTree.Account[2];
accounts = postings.keySet().toArray(accounts);
assertEquals("expenses", accounts[0].getName());
assertEquals("assets", accounts[1].getName());
assertEquals("10", postings.get(accounts[0]).toString());
assertNull(postings.get(accounts[1]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment