/** Tests that a ROOT account will always be created in the system */ @Test public void shouldCreateDefaultRootAccount() { Account account = new Account("Some account"); mAccountsDbAdapter.addRecord(account); assertThat(mAccountsDbAdapter.getRecordsCount()).isEqualTo(2L); List<Account> accounts = mAccountsDbAdapter.getSimpleAccountList(); assertThat(accounts).extracting("mAccountType").contains(AccountType.ROOT); String rootAccountUID = mAccountsDbAdapter.getOrCreateGnuCashRootAccountUID(); assertThat(rootAccountUID).isEqualTo(accounts.get(1).getParentUID()); }
@Test public void simpleAccountListShouldNotContainTransactions() { Account account = new Account("Test"); Transaction transaction = new Transaction("Test description"); Split split = new Split(Money.getZeroInstance(), account.getUID()); transaction.addSplit(split); Account account1 = new Account("Transfer"); transaction.addSplit(split.createPair(account1.getUID())); mAccountsDbAdapter.addRecord(account); mAccountsDbAdapter.addRecord(account1); List<Account> accounts = mAccountsDbAdapter.getSimpleAccountList(); for (Account testAcct : accounts) { assertThat(testAcct.getTransactionCount()).isZero(); } }