### Question:
ContainerSet { public void listContainer(long startContainerId, long count, List<ContainerData> data) throws StorageContainerException { Preconditions.checkNotNull(data, "Internal assertion: data cannot be null"); Preconditions.checkState(startContainerId >= 0, "Start container Id cannot be negative"); Preconditions.checkState(count > 0, "max number of containers returned " + "must be positive"); LOG.debug("listContainer returns containerData starting from {} of count " + "{}", startContainerId, count); ConcurrentNavigableMap<Long, Container<?>> map; if (startContainerId == 0) { map = containerMap; } else { map = containerMap.tailMap(startContainerId, true); } int currentCount = 0; for (Container<?> entry : map.values()) { if (currentCount < count) { data.add(entry.getContainerData()); currentCount++; } else { return; } } }  boolean addContainer(Container<?> container); Container<?> getContainer(long containerId); boolean removeContainer(long containerId); @VisibleForTesting int containerCount(); void handleVolumeFailures(); Iterator<Container<?>> getContainerIterator(); Iterator<Container<?>> getContainerIterator(HddsVolume volume); Iterator<Map.Entry<Long, Container<?>>> getContainerMapIterator(); @VisibleForTesting Map<Long, Container<?>> getContainerMapCopy(); Map<Long, Container<?>> getContainerMap(); void listContainer(long startContainerId, long count,
                            List<ContainerData> data); ContainerReportsProto getContainerReport(); Set<Long> getMissingContainerSet(); void buildMissingContainerSetAndValidate(
      Map<Long, Long> container2BCSIDMap);  }### Answer:
@Test public void testListContainer() throws StorageContainerException { ContainerSet containerSet = createContainerSet(); int count = 5; int startId = FIRST_ID + 3; List<ContainerData> result = new ArrayList<>(count); containerSet.listContainer(startId, count, result); assertContainerIds(startId, count, result); }
@Test public void testListContainerFromFirstKey() throws StorageContainerException { ContainerSet containerSet = createContainerSet(); int count = 6; List<ContainerData> result = new ArrayList<>(count); containerSet.listContainer(0, count, result); assertContainerIds(FIRST_ID, count, result); }