### Question:
ReconContainerManager extends SCMContainerManager { public void checkAndAddNewContainer(ContainerID containerID, ContainerReplicaProto.State replicaState, DatanodeDetails datanodeDetails) throws IOException { if (!exists(containerID)) { LOG.info("New container {} got from {}.", containerID, datanodeDetails.getHostName()); ContainerWithPipeline containerWithPipeline = scmClient.getContainerWithPipeline(containerID.getId()); LOG.debug("Verified new container from SCM {}, {} ", containerID, containerWithPipeline.getPipeline().getId()); if (!exists(containerID)) { addNewContainer(containerID.getId(), containerWithPipeline); } } else { ContainerInfo containerInfo = getContainer(containerID); if (containerInfo.getState().equals(HddsProtos.LifeCycleState.OPEN) && !replicaState.equals(ContainerReplicaProto.State.OPEN) && isHealthy(replicaState)) { LOG.info("Container {} has state OPEN, but Replica has State {}.", containerID, replicaState); updateContainerState(containerID, FINALIZE); } } } ReconContainerManager(
      ConfigurationSource conf,
      Table<ContainerID, ContainerInfo> containerStore,
      BatchOperationHandler batchHandler,
      PipelineManager pipelineManager,
      StorageContainerServiceProvider scm,
      ContainerSchemaManager containerSchemaManager); void checkAndAddNewContainer(ContainerID containerID,
      ContainerReplicaProto.State replicaState,
      DatanodeDetails datanodeDetails); void addNewContainer(long containerId,
                              ContainerWithPipeline containerWithPipeline); @Override void updateContainerReplica(ContainerID containerID,
      ContainerReplica replica); ContainerSchemaManager getContainerSchemaManager();  }### Answer:
@Test public void testCheckAndAddNewContainer() throws IOException { ContainerID containerID = new ContainerID(100L); ReconContainerManager containerManager = getContainerManager(); assertFalse(containerManager.exists(containerID)); DatanodeDetails datanodeDetails = randomDatanodeDetails(); containerManager.checkAndAddNewContainer(containerID, OPEN, datanodeDetails); assertTrue(containerManager.exists(containerID)); containerManager.checkAndAddNewContainer(containerID, OPEN, datanodeDetails); assertTrue(containerManager.exists(containerID)); assertEquals(LifeCycleState.OPEN, getContainerManager().getContainer(containerID).getState()); }