### Question:
KeyValueHandler extends Handler { @Override public void deleteContainer(Container container, boolean force) throws IOException { deleteInternal(container, force); } KeyValueHandler(ConfigurationSource config, String datanodeId,
      ContainerSet contSet, VolumeSet volSet, ContainerMetrics metrics,
      Consumer<ContainerReplicaProto> icrSender); @VisibleForTesting VolumeChoosingPolicy getVolumeChoosingPolicyForTesting(); @Override void stop(); @Override ContainerCommandResponseProto handle(
      ContainerCommandRequestProto request, Container container,
      DispatcherContext dispatcherContext); @VisibleForTesting ChunkManager getChunkManager(); @VisibleForTesting BlockManager getBlockManager(); @Override Container importContainer(ContainerData originalContainerData,
      final InputStream rawContainerStream,
      final TarContainerPacker packer); @Override void exportContainer(final Container container,
      final OutputStream outputStream,
      final TarContainerPacker packer); @Override void markContainerForClose(Container container); @Override void markContainerUnhealthy(Container container); @Override void quasiCloseContainer(Container container); @Override void closeContainer(Container container); @Override void deleteContainer(Container container, boolean force); @Override void deleteBlock(Container container, BlockData blockData);  }### Answer:
@Test public void testDeleteContainer() throws IOException { final String testDir = GenericTestUtils.getTempPath( TestKeyValueHandler.class.getSimpleName() + "-" + UUID.randomUUID().toString()); try { final long containerID = 1L; final ConfigurationSource conf = new OzoneConfiguration(); final ContainerSet containerSet = new ContainerSet(); final VolumeSet volumeSet = Mockito.mock(VolumeSet.class); Mockito.when(volumeSet.getVolumesList()) .thenReturn(Collections.singletonList( new HddsVolume.Builder(testDir).conf(conf).build())); final int[] interval = new int[1]; interval[0] = 2; final ContainerMetrics metrics = new ContainerMetrics(interval); final AtomicInteger icrReceived = new AtomicInteger(0); final KeyValueHandler kvHandler = new KeyValueHandler(conf, UUID.randomUUID().toString(), containerSet, volumeSet, metrics, c -> icrReceived.incrementAndGet()); kvHandler.setScmID(UUID.randomUUID().toString()); final ContainerCommandRequestProto createContainer = ContainerCommandRequestProto.newBuilder() .setCmdType(ContainerProtos.Type.CreateContainer) .setDatanodeUuid(UUID.randomUUID().toString()) .setCreateContainer( ContainerProtos.CreateContainerRequestProto.newBuilder() .setContainerType(ContainerType.KeyValueContainer) .build()) .setContainerID(containerID) .setPipelineID(UUID.randomUUID().toString()) .build(); kvHandler.handleCreateContainer(createContainer, null); Assert.assertEquals(1, icrReceived.get()); Assert.assertNotNull(containerSet.getContainer(containerID)); kvHandler.deleteContainer(containerSet.getContainer(containerID), true); Assert.assertEquals(2, icrReceived.get()); Assert.assertNull(containerSet.getContainer(containerID)); } finally { FileUtils.deleteDirectory(new File(testDir)); } }