@Test
  public void testAccountEqual() {
    // Check two accounts with same fields but no containers.
    Account accountNoContainer = new AccountBuilder(refAccountId, refAccountName, refAccountStatus).build();
    Account accountNoContainerDuplicate = new AccountBuilder(refAccountId, refAccountName, refAccountStatus).build();
    assertEquals("Two accounts should be equal.", accountNoContainer, accountNoContainerDuplicate);

    // Check two accounts with same fields and containers.
    Account accountWithContainers = refAccount;
    Account accountWithContainersDuplicate = new AccountBuilder(refAccount).build();
    assertEquals("Two accounts should be equal.", accountWithContainers, accountWithContainersDuplicate);

    // Check two accounts with same fields but one has containers, the other one does not.
    assertFalse("Two accounts should not be equal.", accountNoContainer.equals(accountWithContainers));

    // Check two accounts with the same fields and the same number of containers. One container of one account has one
    // field different from the other one.
    Container updatedContainer = buildContainerWithOtherFields(
        new ContainerBuilder(refContainerIds.get(0), refContainerNames.get(0), refContainerStatuses.get(0),
            "A changed container description", refAccountId), refContainers.get(0));
    refContainers.remove(0);
    refContainers.add(updatedContainer);
    Account accountWithModifiedContainers = new AccountBuilder(refAccountId, refAccountName, refAccountStatus).build();
    assertFalse("Two accounts should not be equal.", accountWithContainers.equals(accountWithModifiedContainers));
  }
Tests {@link Account#equals(Object)} that checks equality of {@link Container}s.
ambry-api/src/test/java/com/github/ambry/account/AccountContainerTest.java