use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class DeleteCommandTest method testMessageIgnoresUserFromDeletedGroup.
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 });
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class DeleteCommandTest method testDeleteGroup_WithUsers.
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());
myIDEFacade.expects(once()).method("askQuestion").will(returnValue(true));
myCommand.execute();
assertEquals(0, myUserModel.getAllUsers().length);
assertEquals(0, myUserModel.getGroups().length);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class FindUsersCommandTest method testSetGroupBasingOnSelection.
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());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class FindUsersCommandTest method setTeddyUserIsFound.
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;
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class TestFactory method createUserListWithUsers.
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;
}
Aggregations