@Test
public void testPersist() throws AmbariException {

  ActionManager actionManager = createStrictMock(ActionManager.class);
  RequestFactory requestFactory = createStrictMock(RequestFactory.class);
  Request request = createStrictMock(Request.class);
  Stage stage1 = createNiceMock(Stage.class);
  Stage stage2 = createNiceMock(Stage.class);
  List<Stage> stages = new ArrayList<Stage>();
  stages.add(stage1);
  stages.add(stage2);
  //expectations
  expect(requestFactory.createNewFromStages(stages)).andReturn(request);
  expect(request.getStages()).andReturn(stages).anyTimes();
  actionManager.sendActions(request, null);
  replay(actionManager, requestFactory, request, stage1, stage2);
  RequestStageContainer requestStages = new RequestStageContainer(1L, stages, requestFactory, actionManager);
  requestStages.persist();
  verify(actionManager, requestFactory, request, stage1, stage2);
}