### Question:
CloseContainerEventHandler implements EventHandler<ContainerID> { private List<DatanodeDetails> getNodes(final ContainerInfo container) throws ContainerNotFoundException { try { return pipelineManager.getPipeline(container.getPipelineID()).getNodes(); } catch (PipelineNotFoundException ex) { return containerManager.getContainerReplicas(container.containerID()) .stream() .map(ContainerReplica::getDatanodeDetails) .collect(Collectors.toList()); } } CloseContainerEventHandler(final PipelineManager pipelineManager,
      final ContainerManager containerManager); @Override void onMessage(ContainerID containerID, EventPublisher publisher); static final Logger LOG; }### Answer:
@Test public void testCloseContainerEventWithRatis() throws IOException { GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer .captureLogs(CloseContainerEventHandler.LOG); ContainerInfo container = containerManager .allocateContainer(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE, OzoneConsts.OZONE); ContainerID id = container.containerID(); int[] closeCount = new int[3]; eventQueue.fireEvent(CLOSE_CONTAINER, id); eventQueue.processAll(1000); int i = 0; for (DatanodeDetails details : pipelineManager .getPipeline(container.getPipelineID()).getNodes()) { closeCount[i] = nodeManager.getCommandCount(details); i++; } i = 0; for (DatanodeDetails details : pipelineManager .getPipeline(container.getPipelineID()).getNodes()) { Assert.assertEquals(closeCount[i], nodeManager.getCommandCount(details)); i++; } eventQueue.fireEvent(CLOSE_CONTAINER, id); eventQueue.processAll(1000); i = 0; for (DatanodeDetails details : pipelineManager .getPipeline(container.getPipelineID()).getNodes()) { Assert.assertEquals(closeCount[i] + 1, nodeManager.getCommandCount(details)); Assert.assertEquals(HddsProtos.LifeCycleState.CLOSING, containerManager.getContainer(id).getState()); i++; } }