@Test public void shouldReassignDescendantAccounts() { loadDefaultAccounts(); String savingsAcctUID = mAccountsDbAdapter.findAccountUidByFullName("Assets:Current Assets:Savings Account"); String currentAssetsUID = mAccountsDbAdapter.findAccountUidByFullName("Assets:Current Assets"); String assetsUID = mAccountsDbAdapter.findAccountUidByFullName("Assets"); assertThat(mAccountsDbAdapter.getParentAccountUID(savingsAcctUID)).isEqualTo(currentAssetsUID); mAccountsDbAdapter.reassignDescendantAccounts(currentAssetsUID, assetsUID); assertThat(mAccountsDbAdapter.getParentAccountUID(savingsAcctUID)).isEqualTo(assetsUID); assertThat(mAccountsDbAdapter.getFullyQualifiedAccountName(savingsAcctUID)) .isEqualTo("Assets:Savings Account"); }
@Test public void shouldGetDescendantAccounts() { loadDefaultAccounts(); String uid = mAccountsDbAdapter.findAccountUidByFullName("Expenses:Auto"); List<String> descendants = mAccountsDbAdapter.getDescendantAccountUIDs(uid, null, null); assertThat(descendants).hasSize(4); }