### Question:
ContainerEndpoint { @GET @Path("/{id}/replicaHistory") public Response getReplicaHistoryForContainer( @PathParam("id") Long containerID) { return Response.ok( containerSchemaManager.getAllContainerHistory(containerID)).build(); } @Inject  ContainerEndpoint(OzoneStorageContainerManager reconSCM,
                           ContainerSchemaManager containerSchemaManager); @GET Response getContainers(
      @DefaultValue(DEFAULT_FETCH_COUNT) @QueryParam(RECON_QUERY_LIMIT)
          int limit,
      @DefaultValue(PREV_CONTAINER_ID_DEFAULT_VALUE)
      @QueryParam(RECON_QUERY_PREVKEY) long prevKey); @GET @Path("/{id}/keys") Response getKeysForContainer(
      @PathParam("id") Long containerID,
      @DefaultValue(DEFAULT_FETCH_COUNT) @QueryParam(RECON_QUERY_LIMIT)
          int limit,
      @DefaultValue(StringUtils.EMPTY) @QueryParam(RECON_QUERY_PREVKEY)
          String prevKeyPrefix); @GET @Path("/{id}/replicaHistory") Response getReplicaHistoryForContainer(
      @PathParam("id") Long containerID); @GET @Path("/missing") Response getMissingContainers(); @GET @Path("/unhealthy/{state}") Response getUnhealthyContainers(
      @PathParam("state") String state,
      @DefaultValue(DEFAULT_FETCH_COUNT) @QueryParam(RECON_QUERY_LIMIT)
          int limit,
      @DefaultValue(DEFAULT_BATCH_NUMBER)
      @QueryParam(RECON_QUERY_BATCH_PARAM) int batchNum); @GET @Path("/unhealthy") Response getUnhealthyContainers(
      @DefaultValue(DEFAULT_FETCH_COUNT) @QueryParam(RECON_QUERY_LIMIT)
          int limit,
      @DefaultValue(DEFAULT_BATCH_NUMBER)
      @QueryParam(RECON_QUERY_BATCH_PARAM) int batchNum);  }### Answer:
@Test public void testGetReplicaHistoryForContainer() { containerSchemaManager.upsertContainerHistory(1L, "host1", 1L); containerSchemaManager.upsertContainerHistory(1L, "host2", 2L); containerSchemaManager.upsertContainerHistory(1L, "host3", 3L); containerSchemaManager.upsertContainerHistory(1L, "host4", 4L); containerSchemaManager.upsertContainerHistory(1L, "host1", 5L); Response response = containerEndpoint.getReplicaHistoryForContainer(1L); List<ContainerHistory> histories = (List<ContainerHistory>) response.getEntity(); Set<String> datanodes = Collections.unmodifiableSet( new HashSet<>(Arrays.asList("host1", "host2", "host3", "host4"))); Assert.assertEquals(4, histories.size()); histories.forEach(history -> { Assert.assertTrue(datanodes.contains(history.getDatanodeHost())); if (history.getDatanodeHost().equals("host1")) { Assert.assertEquals(1L, (long) history.getFirstReportTimestamp()); Assert.assertEquals(5L, (long) history.getLastReportTimestamp()); } }); }