Source:
private long verifyAndGetContainerValidSize(BlobStoreStats blobStoreStats, long referenceTimeInMs) throws StoreException { Map<String, Map<String, Long>> actualContainerValidSizeMap = blobStoreStats.getValidDataSizeByContainer(referenceTimeInMs); Map<String, Map<String, Long>> expectedContainerValidSizeMap = getValidSizeByContainer(referenceTimeInMs); long totalValidSize = 0L; for (Map.Entry<String, Map<String, Long>> expectedContainerValidSizeEntry : expectedContainerValidSizeMap.entrySet()) { String serviceId = expectedContainerValidSizeEntry.getKey(); assertTrue("Expected serviceId: " + serviceId + " not found", actualContainerValidSizeMap.containsKey(serviceId)); Map<String, Long> innerMap = expectedContainerValidSizeEntry.getValue(); for (Map.Entry<String, Long> innerEntry : innerMap.entrySet()) { String containerId = innerEntry.getKey(); assertTrue("Expected containerId: " + containerId + " not found in serviceId: " + serviceId, innerMap.containsKey(containerId)); long expectedContainerValidSize = innerEntry.getValue(); long actualContainerValidSize = actualContainerValidSizeMap.get(serviceId).get(containerId); assertEquals("Valid data size mismatch for serviceId: " + serviceId + " containerId: " + containerId, expectedContainerValidSize, actualContainerValidSize); totalValidSize += expectedContainerValidSize; } assertEquals("Mismatch in number of containerIds in serviceId: " + serviceId, innerMap.size(), actualContainerValidSizeMap.get(serviceId).size()); actualContainerValidSizeMap.remove(serviceId); } for (Map.Entry<String, Map<String, Long>> actualContainerValidSizeEntry : actualContainerValidSizeMap.entrySet()) { if (actualContainerValidSizeEntry.getValue().size() != 0) { assertEquals("Additional values found in actual container valid data size map ", 1, actualContainerValidSizeEntry.getValue().size()); for (Map.Entry<String, Long> mapEntry : actualContainerValidSizeEntry.getValue().entrySet()) { assertEquals("Additional values found in actual container valid size map ", 0, mapEntry.getValue().longValue()); } } } return totalValidSize; }

Target:
private long verifyAndGetContainerValidSize(BlobStoreStats blobStoreStats, long referenceTimeInMs) throws StoreException { Map<String, Map<String, Long>> actualContainerValidSizeMap = blobStoreStats.getValidDataSizeByContainer(referenceTimeInMs); Map<String, Map<String, Long>> expectedContainerValidSizeMap = getValidSizeByContainer(referenceTimeInMs); long totalValidSize = 0L; for (Map.Entry<String, Map<String, Long>> expectedContainerValidSizeEntry : expectedContainerValidSizeMap.entrySet()) { String serviceId = expectedContainerValidSizeEntry.getKey(); assertTrue("Expected serviceId: " + serviceId + " not found", actualContainerValidSizeMap.containsKey(serviceId)); Map<String, Long> innerMap = expectedContainerValidSizeEntry.getValue(); for (Map.Entry<String, Long> innerEntry : innerMap.entrySet()) { String containerId = innerEntry.getKey(); assertTrue("Expected containerId: " + containerId + " not found in serviceId: " + serviceId, innerMap.containsKey(containerId)); long expectedContainerValidSize = innerEntry.getValue(); long actualContainerValidSize = actualContainerValidSizeMap.get(serviceId).get(containerId); assertEquals("Valid data size mismatch for serviceId: " + serviceId + " containerId: " + containerId, expectedContainerValidSize, actualContainerValidSize); totalValidSize += expectedContainerValidSize; } assertEquals("Mismatch in number of containerIds in serviceId: " + serviceId, innerMap.size(), actualContainerValidSizeMap.get(serviceId).size()); actualContainerValidSizeMap.remove(serviceId); } for (Map.Entry<String, Map<String, Long>> actualContainerValidSizeEntry : actualContainerValidSizeMap.entrySet()) { if (actualContainerValidSizeEntry.getValue().size() != 0) { for (Map.Entry<String, Long> mapEntry : actualContainerValidSizeEntry.getValue().entrySet()) { assertEquals("Additional values found in actual container valid size map ", 0, mapEntry.getValue().longValue()); } } } return totalValidSize; }