public void verifyExecuted(final CommandResponse response, final String... commands) {

    Mockito.verify(config).execute(source, "", "get-view", source.entity());

    for (final String cmd : commands) {

      Mockito.verify(config).execute(destination, "view-configuration", cmd, destination.entity());
    }

    Mockito.verifyNoMoreInteractions(config);

    assertTrue(response.succeeded());
  }
  @Before
  public void setUp() {

    config = Mockito.mock(ConfigTransfer.class);
    handler = Mockito.spy(new CloneView(config));

    responseCreate = CommandResponse.accumulate().returnCode(0);
    responseUpdate = CommandResponse.accumulate().returnCode(0);
    responseFetch = CommandResponse.accumulate().returnCode(0);
    responseFetch.out().append("view-configuration");

    Mockito.doReturn(source).when(handler).source();
    Mockito.doReturn(Arrays.asList(destination)).when(handler).destinations();

    Mockito.doReturn(responseFetch).when(config).execute(source, "", "get-view", source.entity());
    Mockito.doReturn(responseCreate)
        .when(config)
        .execute(destination, "view-configuration", "create-view", destination.entity());
    Mockito.doReturn(responseUpdate)
        .when(config)
        .execute(destination, "view-configuration", "update-view", destination.entity());
  }
  private CommandResponse response() {

    return handler.run(CommandResponse.accumulate());
  }