Exemple #1
0
  @Test
  public void assertListFromServerIsRetrievedOnce() throws Exception {
    when(server.execute(isA(MaskedArgumentListBuilder.class)))
        .thenReturn(
            new StringReader(
                "--------- -------------- -------- ----------------------------------------------------------------------------------------------------------\n"
                    + "\n"
                    + "name1     SND\\redsolo_cp COMPUTER\n"));

    Workspaces workspaces = new Workspaces(server);
    Workspace workspace = workspaces.getWorkspace("name1");
    assertNotNull("Workspace was null", workspace);
    workspace = workspaces.getWorkspace("name1");
    assertNotNull("Workspace was null", workspace);

    verify(server, times(1)).execute(isA(MaskedArgumentListBuilder.class));
  }
Exemple #2
0
  @Test
  public void assertGettingNewWorkspaceIsNotRetrievingServerList() throws Exception {
    when(server.execute(isA(MaskedArgumentListBuilder.class))).thenReturn(new StringReader(""));

    Workspaces workspaces = new Workspaces(server);
    workspaces.newWorkspace("name1");
    assertNotNull("The get new workspace returned null", workspaces.getWorkspace("name1"));
    verify(server, times(1)).execute(isA(MaskedArgumentListBuilder.class));
  }
Exemple #3
0
 @Test
 public void assertGetUnknownWorkspaceReturnsNull() throws Exception {
   when(server.execute(isA(MaskedArgumentListBuilder.class))).thenReturn(new StringReader(""));
   Workspaces workspaces = new Workspaces(server);
   assertNull("The unknown workspace was not null", workspaces.getWorkspace("name1"));
 }