@Test
  public void testAccountUpdatesInTransaction() throws Exception {

    // New account (1,a1) with 5 containers
    List<Container> containerList1 = new ArrayList<>();
    for (int i = 1; i <= 5; i++) {
      containerList1.add(
          new ContainerBuilder((short) i, "c" + i, Container.ContainerStatus.ACTIVE, "c" + i, (short) 1).build());
    }
    Account a1 = new AccountBuilder((short) 1, "a1", Account.AccountStatus.ACTIVE).containers(containerList1).build();

    // New account (2,a2) with 5 containers
    List<Container> containersList2 = new ArrayList<>();
    for (int i = 1; i <= 5; i++) {
      containersList2.add(
          new ContainerBuilder((short) i, "c" + i, Container.ContainerStatus.ACTIVE, "c" + i, (short) 2).build());
    }
    Account a2 = new AccountBuilder((short) 2, "a2", Account.AccountStatus.ACTIVE).containers(containersList2).build();

    mySqlAccountService.updateAccounts(Arrays.asList(a1, a2));

    // Verify all accounts and containers are added.
    assertEquals("Mismatch in number of accounts", 2, mySqlAccountService.getAllAccounts().size());
    assertEquals("Mismatch in account information of a1", a1, mySqlAccountService.getAccountById(a1.getId()));
    assertEquals("Mismatch in account information of a2", a2, mySqlAccountService.getAccountById(a2.getId()));
  }
Tests addition of multiple accounts in single transaction
ambry-account/src/integration-test/java/com/github/ambry/account/MySqlAccountServiceIntegrationTest.java