@Test
  public void testAddWithLegacyAccountsFromOlderDatabase() {
    assertThat(AccountDb.deleteDatabase(DependencyInjector.getContext())).isTrue();
    SQLiteDatabase database = createOlderDatabaseWithRecords();
    database.close();
    database = null;

    accountDb = new AccountDb(DependencyInjector.getContext());

    // Lookup an account and validate it
    TestAccount orig = findTestAccountByName(TEST_ACCOUNTS_WITH_NULL_ISSUER, "johndoe@gmail.com");
    validateAccountRecord(orig, orig.secret, orig.type, orig.counter, true);
    // Old records have no OriginalName set
    assertThat(accountDb.getOriginalName(orig)).isNull();

    // Add a duplicate account with no issuer, to see that it is renamed
    TestAccount dup = new TestAccount(orig);
    dup.secret = SECRET2;
    addTestAccount(dup);
    String dupName = dup.name + "(1)"; // Expected renaming
    // Due to the renaming, we no longer assume this is a Google account based on the name alone
    validateAccountRecord(index(dupName, null), dup.secret, dup.type, dup.counter, false);
    // Check that the original was unaffected
    validateAccountRecord(orig, orig.secret, orig.type, orig.counter, true);

    // These accounts are assumed to be a Google account iff they are from an old database
    assertThat(accountDb.isGoogleAccount(index("2@gmail.com", null))).isTrue();
    assertThat(accountDb.isGoogleAccount(index("3@google.com", null))).isTrue();
  }
Note: caller should carefully determine the expected value of {@code isGoogleAccount}, which
is affected by multiple factors.

@param isGoogleAccount is a {@code boolean}, not a {@link Boolean}
javatests/com/google/android/apps/authenticator/otp/AccountDbTest.java