Package jetbrains.communicator.mock

Examples of jetbrains.communicator.mock.MockUser


    assertFalse(myUserModel.removeGroup("group"));

    myUserModel.addGroup("added1");
    myUserModel.addGroup("added2");

    final MockUser addedUser = new MockUser("some addedUser", "added2");
    myUserModel.addUser(addedUser);

    assertTrue("Do not contain users, can be removed", myUserModel.removeGroup("added1"));
    assertTrue("Contains users, removed including users", myUserModel.removeGroup("group1"));
View Full Code Here


    User addedUser = myUserModel.getAllUsers()[0];
    assertEquals("aaaaaa", addedUser.getName());
  }

  public void testAddUser() throws Exception {
    MockUser user = new MockUser("user", null);
    myUserModel.addUser(user);

    assertTrue(myUserModel.hasUser(user));
    myListener.assertLog("Expect messages", "BeforeAfter");
View Full Code Here

    myUserModel.addUser(user);
    myListener.assertLog("Expect no messages when already in model", "");
  }

  public void testRemoveUser() throws Exception {
    MockUser user = new MockUser("user", null);
    myUserModel.addUser(user);
    myListener.clear();

    myUserModel.removeUser(user);
    myListener.assertLog("Expect messages", "BeforeAfter");
View Full Code Here

    assertTrue(myIDEFacade.getAndClearLog().startsWith("showMessage"));
  }

  public void testOnlySelfFound() throws Exception {

    final BaseUserImpl self = new MockUser();

    myTransportMock.expects(once()).method("findUsers").will(returnValue(new User[]{self}));
    myTransportMock1.expects(once()).method("findUsers").will(returnValue(new User[]{self}));

    myCommand.execute();
View Full Code Here

    assertTrue(myIDEFacade.getAndClearLog().startsWith("showMessage"));
  }

  public void testUsersFromDifferentTransportsFound() throws Exception {
    final BaseUserImpl teddy = new MockUser("teddy", "");
    final BaseUserImpl sashka = new MockUser("sashka", "");

    myTransportMock.expects(once()).method("findUsers").will(returnValue(new User[]{teddy}));
    myTransportMock1.expects(once()).method("findUsers").will(returnValue(new User[]{sashka}));

    myUserModelMock.expects(once()).method("getGroups").will(returnValue(null));
View Full Code Here

    assertEquals("chooseUsersToBeAdded", myIDEFacade.getAndClearLog());
  }

  public void testSetGroupBasingOnSelection() throws Exception {
    final MockUser teddy = setTeddyUserIsFound();

    myUserModelMock.expects(once()).method("hasUser").with(eq(teddy)).will(returnValue(false));
    myUserModelMock.expects(once()).method("getGroups").will(returnValue(null));

    myIDEFacade.setReturnedData(new FindUsersCommand.UsersInfo(new User[]{teddy}, UserModel.AUTO_GROUP));
    teddy.setProjects(new String[]{"projectForTeddy"});

    myUserModelMock.expects(once()).method("findUser").with(eq(teddy.getName()), eq(teddy.getTransportCode()))
        .will(returnValue(teddy));
    myUserModelMock.expects(once()).method("addUser").with(eq(teddy));
    myCommand.execute();

    assertEquals("Group should be set from project name", "projectForTeddy", teddy.getGroup());
  }
View Full Code Here

    assertEquals("User group should be updated", "new group", teddy.getGroup());
  }


  private MockUser setTeddyUserIsFound() throws UnknownHostException {
    final MockUser teddy = new MockUser("teddy", "");

    myTransportMock.expects(once()).method("findUsers").will(returnValue(new User[]{teddy}));
    myTransportMock1.expects(once()).method("findUsers").will(returnValue(new User[0]));
    return teddy;
  }
View Full Code Here

        "</users>",
        fileText);
  }

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

    PersistentUserModelImpl modelInstance = createModelInstance();
    User[] users = modelInstance.getAllUsers();
    assertEquals(1, users.length);
    assertEquals("user", users[0].getName());
View Full Code Here

    assertEquals("user", users[0].getName());
    assertEquals("group", users[0].getGroup());
  }

  public void testAddAndChangeUser() throws Exception {
    myUserModel.addUser(new MockUser("user", "group"));
    checkSaved(true);
    User user = myUserModel.getAllUsers()[0];
    user.setDisplayName("dds dds", myUserModel);
    checkSaved(true);
    user.setGroup("newGroup", myUserModel);
View Full Code Here

    disposeOnTearDown(myUserModel);
    myCommand = new SendMessageCommand(myUserModel, myMockUserListComponent, (IDEFacade) myFacadeMock.proxy());
  }

  public void testInvokeDialog() throws Exception {
    MockUser user1 = new MockUser("user1", null);
    MockUser user2 = new MockUser("user2", null);
    MockUser user3 = new MockUser("user3", null);
    myUserModel.addUser(user1);
    myUserModel.addUser(user2);
    myUserModel.addUser(user3);
    myMockUserListComponent.setSelectedNodes(new Object[]{"a group", user2, "grp2", user1});
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.