Package jetbrains.communicator.mock

Examples of jetbrains.communicator.mock.MockUser


    myCommand.execute();
  }

  public void testInvokeDialogWithExplicitUser() throws Exception {
    MockUser user1 = new MockUser();
    myUserModel.addUser(user1);
    myCommand.setUser(user1);

    myFacadeMock.expects(once()).method("invokeSendMessage").with(
        eq(myUserModel.getAllUsers()),
View Full Code Here


    verifySendMessageLocalEvent(user, "message1");
  }

  private MockUser createUser() {
    final MockUser user = new MockUser("user", null) {
      @Override
      public void sendMessage(String comment, EventBroadcaster eventBroadcaster) {
        myLog += toString() + ' ' + comment;
      }
    };
View Full Code Here

    assertFalse("Already has added user",
        myTransport.canAddUsers("IDEA", Arrays.asList(user("foo"), user("bar"))));
  }

  private User user(String s) {
    return new MockUser(s, null);
  }
View Full Code Here

        .will(returnValue(new Object[]{"some group"}));
    assertNotNull(myCommand.getText());
  }
 
  public void testEnableAccessToUser() throws Exception {
    MockUser user = new MockUser();

    myUserListComponent.stubs().method("getSelectedNodes")
        .will(returnValue(new Object[]{user}));

    user.setCanAccessMyFiles(true, null);
    myCommand.execute();

    assertFalse("Should change access", user.canAccessMyFiles());
    myCommand.execute();
    assertTrue("Should change access again", user.canAccessMyFiles());
  }
View Full Code Here

    myCommand.execute();
    assertTrue("Should change access again", user.canAccessMyFiles());
  }

  public void testEnableAccessToGroup() throws Exception {
    MockUser enabled = new MockUser("enabled", "group");
    enabled.setCanAccessMyFiles(true, myUserModel);
    MockUser disabled = new MockUser("disabled", "group");
    disabled.setCanAccessMyFiles(false, myUserModel);

    myUserModel.addUser(enabled);
    myUserModel.addUser(disabled);

    myUserListComponent.stubs().method("getSelectedNodes")
        .will(returnValue(new Object[]{"group"}));

    myCommand.execute();
    assertTrue("Should change access to disabled", disabled.canAccessMyFiles());
    assertFalse("Should change access to enabled", enabled.canAccessMyFiles());
  }
View Full Code Here

    assertTrue("Should change access to disabled", disabled.canAccessMyFiles());
    assertFalse("Should change access to enabled", enabled.canAccessMyFiles());
  }

  public void testMultipleSelection_NoGroups() throws Exception {
    MockUser user1 = new MockUser("User1", "a");
    MockUser user2 = new MockUser("User2", "a");

    myUserListComponent.stubs().method("getSelectedNodes")
        .will(returnValue(new Object[]{user1, user2}));

View Full Code Here

    assertFalse(myCommand.isEnabled());

    myCommand.setVFile(VFile.create("a path"));
    assertFalse(myCommand.isEnabled());

    myCommand.setUser(new MockUser());
    assertTrue("Now codePointer, file, user are selected - ready to send", myCommand.isEnabled());
  }
View Full Code Here

  public void testExecute_WithMessage() throws Exception {
    final CodePointer codePointerToSend = new CodePointer(0, 0);
    final VFile fileToSend = VFile.create("a path");

    final boolean [] sent = new boolean[1];
    MockUser user = new MockUser() {
      @Override
      public void sendCodeIntervalPointer(VFile file, CodePointer pointer, String comment, EventBroadcaster eventBroadcaster) {
        sent[0] = true;
        assertSame(fileToSend, file);
        assertSame(codePointerToSend, pointer);
View Full Code Here

  }

  public void testExecute_Cancel() throws Exception {

    final boolean [] sent = new boolean[1];
    MockUser user = new MockUser() {
      @Override
      public void sendCodeIntervalPointer(VFile file, CodePointer pointer, String comment, EventBroadcaster eventBroadcaster) {
        sent[0] = true;
      }
    };
View Full Code Here

    assertFalse(myCommand.isEnabled());

    myMockUserListComponent.setSelectedNodes(new Object[]{"group"});
    assertFalse(myCommand.isEnabled());

    MockUser mockUser = new MockUser("user", null);
    myMockUserListComponent.setSelectedNodes(new User[]{mockUser});
    assertFalse("User is offline", myCommand.isEnabled());
    mockUser.setOnline(true);

    mockUser.setIDEtalkUser(false);
    assertFalse("Single user selected and online but not IDEtalk user- command should be disabled",
        myCommand.isEnabled());

    mockUser.setIDEtalkUser(true);
    assertTrue("Single user selected and online and IDEtalk user- command should be disabled",
        myCommand.isEnabled());

    myMockUserListComponent.setSelectedNodes(new User[]{mockUser, mockUser});
    assertFalse("Two users are selected", myCommand.isEnabled());
View Full Code Here

TOP

Related Classes of jetbrains.communicator.mock.MockUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.