### Question:
RequestStageContainer { public long getLastStageId() { return stages.isEmpty() ? -1 : stages.get(stages.size() - 1).getStageId(); } RequestStageContainer(Long id, List<Stage> stages, RequestFactory factory, ActionManager manager);  RequestStageContainer(Long id, List<Stage> stages, RequestFactory factory, ActionManager manager,
                               ExecuteActionRequest actionRequest); Long getId(); void setClusterHostInfo(String clusterHostInfo); void addStages(List<Stage> stages); List<Stage> getStages(); long getLastStageId(); void setRequestContext(String context); State getProjectedState(String host, String component); void persist(); RequestStatusResponse getRequestStatusResponse();  }### Answer:
@Test public void testGetLastStageId() { RequestStageContainer requestStages = new RequestStageContainer(1L, null, null, null); assertEquals(-1, requestStages.getLastStageId()); Stage stage1 = createNiceMock(Stage.class); Stage stage2 = createNiceMock(Stage.class); List<Stage> listStages = new ArrayList<>(); listStages.add(stage1); listStages.add(stage2); expect(stage2.getStageId()).andReturn(22L); replay(stage1, stage2); requestStages = new RequestStageContainer(1L, listStages, null, null); assertEquals(22, requestStages.getLastStageId()); }