use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class AbstractMessageDispatcherTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myIdeFacade = new MockIDEFacade(getClass());
myDispatcher = createDispatcher();
myUser = new MockUser("user", null);
myUser.setOnline(true);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class DeleteCommandTest method testDeleteUser.
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();
assertEquals("User should be deleted", 0, myUserModel.getAllUsers().length);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class DeleteCommandTest method testMessages_WithUsersInDeletedGroups.
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) });
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class DeleteCommandTest method assertMessage.
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);
}
Object[] selectedNodes = nodes.toArray(new Object[nodes.size()]);
assertMessage(msg, selectedNodes);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class FindUsersCommandTest method testUsersFromDifferentTransportsFound.
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));
myUserModelMock.expects(once()).method("hasUser").with(eq(teddy)).will(returnValue(false));
myUserModelMock.expects(once()).method("hasUser").with(eq(sashka)).will(returnValue(false));
myCommand.execute();
}
Aggregations