Source:
public void testGetContainerByStatus() throws Exception { Set accountIdSet = new HashSet<>(); refAccountId = Utils.getRandomShort(random); accountIdSet.add(refAccountId); generateRefAccounts(idToRefAccountMap, idToRefContainerMap, accountIdSet, 5, 2); accountService = mockHelixAccountServiceFactory.getAccountService(); accountService.updateAccounts(idToRefAccountMap.values()); assertAccountsInAccountService(idToRefAccountMap.values(), 5, accountService); List<Account> accountsToUpdate = new ArrayList<>(); int cnt = 0; for (Account account : accountService.getAllAccounts()) { AccountBuilder accountBuilder = new AccountBuilder(account); for (Container container : account.getAllContainers()) { if (cnt%2 == 0) { ContainerBuilder containerBuilder = new ContainerBuilder(container); containerBuilder.setId((short) (-1 * (container.getId()))); containerBuilder.setName(container.getName() + "-extra"); containerBuilder.setStatus(ContainerStatus.DELETE_IN_PROGRESS); containerBuilder.setDescription(container.getDescription() + "--extra"); containerBuilder.setReplicationPolicy(container.getReplicationPolicy() + "---extra"); containerBuilder.setTtlRequired(container.isTtlRequired()); accountBuilder.addOrUpdateContainer(containerBuilder.build()); } cnt++; } accountsToUpdate.add(accountBuilder.build()); } updateAccountsAndAssertAccountExistence(accountsToUpdate, 5, true); Set<Pair<Short,Short>> containerList = accountService.getContainersByStatus(ContainerStatus.DELETE_IN_PROGRESS); assertEquals("Wrong number of containers in containerList", 5, containerList.size()); }

Target:
public void testGetContainerByStatus() throws Exception { Set accountIdSet = new HashSet<>(); refAccountId = Utils.getRandomShort(random); accountIdSet.add(refAccountId); generateRefAccounts(idToRefAccountMap, idToRefContainerMap, accountIdSet, 5, 2); accountService = mockHelixAccountServiceFactory.getAccountService(); accountService.updateAccounts(idToRefAccountMap.values()); assertAccountsInAccountService(idToRefAccountMap.values(), 5, accountService); List<Account> accountsToUpdate = new ArrayList<>(); int cnt = 0; for (Account account : accountService.getAllAccounts()) { AccountBuilder accountBuilder = new AccountBuilder(account); for (Container container : account.getAllContainers()) { if (cnt % 2 == 0) { ContainerBuilder containerBuilder = new ContainerBuilder(container); containerBuilder.setId((short) (-1 * (container.getId()))); containerBuilder.setName(container.getName() + "-extra"); containerBuilder.setStatus(ContainerStatus.DELETE_IN_PROGRESS); containerBuilder.setDescription(container.getDescription() + "--extra"); containerBuilder.setReplicationPolicy(container.getReplicationPolicy() + "---extra"); containerBuilder.setTtlRequired(container.isTtlRequired()); accountBuilder.addOrUpdateContainer(containerBuilder.build()); } cnt++; } accountsToUpdate.add(accountBuilder.build()); } updateAccountsAndAssertAccountExistence(accountsToUpdate, 5, true); Set<Container> containerList = accountService.getContainersByStatus(ContainerStatus.DELETE_IN_PROGRESS); assertEquals("Wrong number of containers in containerList", 5, containerList.size()); for (Container container : containerList) { assertSame("Container status mismatch", container.getStatus(), ContainerStatus.DELETE_IN_PROGRESS); } }