Package jetbrains.communicator.mock

Examples of jetbrains.communicator.mock.MockUser


  public static UserModel createUserListWithUsers(BaseTestCase test) throws UnknownHostException {

    UserModelImpl result = new UserModelImpl(test.getBroadcaster());
    test.disposeOnTearDown(result);
    result.addUser(new MockUser("aaa", "group1"));
    result.addUser(new MockUser("ccc", "group1"));

    result.addUser(new MockUser("zzz", "group2", true));
    result.addUser(new MockUser("aaaa", "group2"));
    result.addUser(new MockUser("bbb", "group2"));

    Pico.getInstance().registerComponentInstance(UserModel.class, result);

    return result;
  }
View Full Code Here


  public void testDeleteGroup_Commit() throws Exception {
    _testDeleteGroup(true, 0);
  }

  public void testDeleteGroup_WithUsers() throws Exception {
    myUserModel.addUser(new MockUser("user", GROUP_NAME));

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

    assertTrue("Deleteion of group should be enabled - we delete groups with users", myCommand.isEnabled());
View Full Code Here

    assertEquals(0, myUserModel.getGroups().length);
  }

  public void testDeleteGroup_WithUsers_DeleteAll() throws Exception {
    myUserModel.addGroup(GROUP_NAME);
    MockUser user = new MockUser("user", GROUP_NAME);
    myUserModel.addUser(user);

    myUserListComponentMock.stubs().method("getSelectedNodes").
        will(returnValue(new Object[]{GROUP_NAME, user}));
View Full Code Here

  public void testDeleteGroup_CancelOperation() throws Exception {
    _testDeleteGroup(false, 1);
  }

  public void testDeleteUser() throws Exception {
    MockUser user = new MockUser();
    myUserModel.addUser(user);
    myUserListComponentMock.expects(once()).method("getSelectedNodes").will(returnValue(new Object[]{user}));
    myIDEFacade.expects(once()).method("askQuestion").will(returnValue(true));

    myCommand.execute();
View Full Code Here

    assertMessage("group \"group0\" and \nusers User 0, User 1 \nfrom other groups", 2, 1);
    assertMessage("groups \"group0\", \"group1\" \nand \nusers User 0, User 1 \nfrom other groups", 2, 2);
  }

  public void testMessages_WithUsersInDeletedGroups() throws Exception {
    myUserModel.addUser(new MockUser("userName", "aGroup"));
    assertMessage("group \"aGroup\" with its 1 user", new Object[]{"aGroup"});
    assertMessage("groups \"aGroup\"(1 user) and \"group2\"", new Object[]{"aGroup", "group2"});

    myUserModel.addUser(new MockUser("userName1", "aGroup"));
    assertMessage("group \"aGroup\" with its 2 users", new Object[]{"aGroup"});
    assertMessage("groups \"aGroup\"(2 users) and \"group2\"", new Object[]{"aGroup", "group2"});

    assertMessage("group \"aGroup\"(2 users) and user Some Another User",
        new Object[]{"aGroup", new MockUser("Some Another User", null)});
  }
View Full Code Here

    assertMessage("group \"aGroup\"(2 users) and user Some Another User",
        new Object[]{"aGroup", new MockUser("Some Another User", null)});
  }

  public void testMessageIgnoresUserFromDeletedGroup() throws Exception {
    MockUser user = new MockUser("userName", "aGroup");
    myUserModel.addUser(user);
    assertMessage("group \"aGroup\" with its 1 user", new Object[]{"aGroup", user});
  }
View Full Code Here

  }

  private void assertMessage(String msg, int users, int emptyGroups) throws UnknownHostException {
    List nodes = new ArrayList();
    for (int i = 0; i < users; i ++){
      MockUser u = new MockUser("user" + i, "");
      u.setDisplayName("User " + i, myUserModel);
      nodes.add(u);
    }
    for (int i = 0; i < emptyGroups; i ++){
      nodes.add("group" + i);
    }
View Full Code Here

  }

  public void testEnabled() throws Exception {
    assertFalse(myCommand.isEnabled());

    myCommand.setUser(new MockUser());
    assertFalse(myCommand.isEnabled());

    VFile vFile = VFile.create("a path");
    myCommand.setVFile(vFile);
View Full Code Here

    assertTrue(myCommand.isEnabled());
  }

  public void testExecute() throws Exception {
    final VFile vFile = VFile.create("a file");
    MockUser user = new MockUser() {
      @Override
      public String getVFile(VFile file, IDEFacade ideFacade) {
        assertSame(vFile, file);
        return "something";
      }
View Full Code Here

    myCommand.execute();
  }

  public void testExecute_NoContent() throws Exception {
    final VFile vFile = VFile.create("a file");
    MockUser user = new MockUser() {
      @Override
      public String getVFile(VFile file, IDEFacade ideFacade) {
        assertSame(vFile, file);
        return null;
      }
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.