use of jetbrains.communicator.core.impl.users.BaseUserImpl 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();
}
use of jetbrains.communicator.core.impl.users.BaseUserImpl in project intellij-plugins by JetBrains.
the class FindUsersCommandTest method testOnlyExistingUserFound.
public void testOnlyExistingUserFound() throws Exception {
final BaseUserImpl foundUser = setTeddyUserIsFound();
myUserModelMock.expects(once()).method("hasUser").with(eq(foundUser)).will(returnValue(true));
myCommand.execute();
assertTrue(myIDEFacade.getAndClearLog().startsWith("showMessage"));
}
use of jetbrains.communicator.core.impl.users.BaseUserImpl in project intellij-plugins by JetBrains.
the class FindUsersCommandTest method testOnlySelfFound.
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();
assertTrue(myIDEFacade.getAndClearLog().startsWith("showMessage"));
}
use of jetbrains.communicator.core.impl.users.BaseUserImpl in project intellij-plugins by JetBrains.
the class FindUsersCommandTest method testNewUserFound_AddThisUserToModel.
public void testNewUserFound_AddThisUserToModel() throws Exception {
final BaseUserImpl teddy = setTeddyUserIsFound();
myUserModelMock.expects(once()).method("hasUser").with(eq(teddy)).will(returnValue(false));
myUserModelMock.expects(once()).method("getGroups").will(returnValue(null));
final List<User> userList = new ArrayList<>();
userList.add(teddy);
myIDEFacade.setReturnedData(new FindUsersCommand.UsersInfo(new User[] { teddy }, "new group"));
myUserModelMock.expects(once()).method("addUser").with(eq(teddy));
myUserModelMock.expects(once()).method("findUser").with(eq(teddy.getName()), eq(teddy.getTransportCode())).will(returnValue(teddy));
myCommand.execute();
assertEquals("User group should be updated", "new group", teddy.getGroup());
}
use of jetbrains.communicator.core.impl.users.BaseUserImpl in project intellij-plugins by JetBrains.
the class FindUsersCommandTest method testNewUserFound_AddNoOne.
public void testNewUserFound_AddNoOne() throws Exception {
final BaseUserImpl 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[0], "new group"));
myCommand.execute();
assertEquals("chooseUsersToBeAdded", myIDEFacade.getAndClearLog());
}
Aggregations