### Question:
ContainerDBServiceProviderImpl implements ContainerDBServiceProvider { @Override public Map<ContainerKeyPrefix, Integer> getKeyPrefixesForContainer( long containerId) throws IOException { return getKeyPrefixesForContainer(containerId, StringUtils.EMPTY); } @Inject  ContainerDBServiceProviderImpl(DBStore dbStore,
                                        Configuration sqlConfiguration); @Override void close(); @Override void initNewContainerDB(Map<ContainerKeyPrefix, Integer>
                                     containerKeyPrefixCounts); @Override void storeContainerKeyMapping(ContainerKeyPrefix containerKeyPrefix,
                                       Integer count); @Override void storeContainerKeyCount(Long containerID, Long count); @Override long getKeyCountForContainer(Long containerID); @Override boolean doesContainerExists(Long containerID); @Override Integer getCountForContainerKeyPrefix(
      ContainerKeyPrefix containerKeyPrefix); @Override Map<ContainerKeyPrefix, Integer> getKeyPrefixesForContainer(
      long containerId); @Override Map<ContainerKeyPrefix, Integer> getKeyPrefixesForContainer(
      long containerId, String prevKeyPrefix); @Override Map<Long, ContainerMetadata> getContainers(int limit,
                                                    long prevContainer); @Override void deleteContainerMapping(ContainerKeyPrefix containerKeyPrefix); @Override long getCountForContainers(); @Override TableIterator getContainerTableIterator(); @Override void storeContainerCount(Long count); @Override void incrementContainerCountBy(long count);  }### Answer:
@Test public void testGetKeyPrefixesForContainer() throws Exception { long containerId = 1L; long nextContainerId = 2L; populateKeysInContainers(containerId, nextContainerId); ContainerKeyPrefix containerKeyPrefix1 = new ContainerKeyPrefix(containerId, keyPrefix1, 0); ContainerKeyPrefix containerKeyPrefix2 = new ContainerKeyPrefix( containerId, keyPrefix2, 0); ContainerKeyPrefix containerKeyPrefix3 = new ContainerKeyPrefix( nextContainerId, keyPrefix3, 0); Map<ContainerKeyPrefix, Integer> keyPrefixMap = containerDbServiceProvider.getKeyPrefixesForContainer(containerId); assertEquals(2, keyPrefixMap.size()); assertEquals(1, keyPrefixMap.get(containerKeyPrefix1).longValue()); assertEquals(2, keyPrefixMap.get(containerKeyPrefix2).longValue()); keyPrefixMap = containerDbServiceProvider.getKeyPrefixesForContainer( nextContainerId); assertEquals(1, keyPrefixMap.size()); assertEquals(3, keyPrefixMap.get(containerKeyPrefix3).longValue()); }
@Test public void testGetKeyPrefixesForContainerWithKeyPrefix() throws Exception { long containerId = 1L; long nextContainerId = 2L; populateKeysInContainers(containerId, nextContainerId); ContainerKeyPrefix containerKeyPrefix2 = new ContainerKeyPrefix( containerId, keyPrefix2, 0); Map<ContainerKeyPrefix, Integer> keyPrefixMap = containerDbServiceProvider.getKeyPrefixesForContainer(containerId, keyPrefix1); assertEquals(1, keyPrefixMap.size()); assertEquals(2, keyPrefixMap.get(containerKeyPrefix2).longValue()); keyPrefixMap = containerDbServiceProvider.getKeyPrefixesForContainer( nextContainerId, keyPrefix3); assertEquals(0, keyPrefixMap.size()); keyPrefixMap = containerDbServiceProvider.getKeyPrefixesForContainer( containerId, "V3/B1/invalid"); assertEquals(0, keyPrefixMap.size()); keyPrefixMap = containerDbServiceProvider.getKeyPrefixesForContainer( containerId, keyPrefix3); assertEquals(0, keyPrefixMap.size()); keyPrefixMap = containerDbServiceProvider.getKeyPrefixesForContainer( 10L, ""); assertEquals(0, keyPrefixMap.size()); }