コード例 #1
0
  @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());
  }
コード例 #2
0
  private void viewDoesNotExist() {

    responseUpdate.returnCode(-1);
  }