Search in sources :

Example 1 with BaseUserImpl

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();
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) BaseUserImpl(jetbrains.communicator.core.impl.users.BaseUserImpl) MockUser(jetbrains.communicator.mock.MockUser)

Example 2 with BaseUserImpl

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"));
}
Also used : BaseUserImpl(jetbrains.communicator.core.impl.users.BaseUserImpl)

Example 3 with BaseUserImpl

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"));
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) BaseUserImpl(jetbrains.communicator.core.impl.users.BaseUserImpl) MockUser(jetbrains.communicator.mock.MockUser)

Example 4 with BaseUserImpl

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());
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) ArrayList(java.util.ArrayList) BaseUserImpl(jetbrains.communicator.core.impl.users.BaseUserImpl)

Example 5 with BaseUserImpl

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());
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) BaseUserImpl(jetbrains.communicator.core.impl.users.BaseUserImpl)

Aggregations

BaseUserImpl (jetbrains.communicator.core.impl.users.BaseUserImpl)5 User (jetbrains.communicator.core.users.User)4 MockUser (jetbrains.communicator.mock.MockUser)4 ArrayList (java.util.ArrayList)1