Search in sources :

Example 11 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class ToggleFileAccessCommandTest method testEnableAccessToUser.

public void testEnableAccessToUser() throws Exception {
    MockUser user = new MockUser();
    myUserListComponent.stubs().method("getSelectedNodes").will(returnValue(new Object[] { user }));
    user.setCanAccessMyFiles(true, null);
    myCommand.execute();
    assertFalse("Should change access", user.canAccessMyFiles());
    myCommand.execute();
    assertTrue("Should change access again", user.canAccessMyFiles());
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 12 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class ToggleFileAccessCommandTest method testMultipleSelection_NoGroups.

public void testMultipleSelection_NoGroups() throws Exception {
    MockUser user1 = new MockUser("User1", "a");
    MockUser user2 = new MockUser("User2", "a");
    myUserListComponent.stubs().method("getSelectedNodes").will(returnValue(new Object[] { user1, user2 }));
    testCommandStateChanges(user1, user2);
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 13 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class ViewFilesCommandTest method testExecute_NoInformation.

public void testExecute_NoInformation() throws Exception {
    final ProjectsData projectsData = new ProjectsData();
    MockUser mockUser = new MockUser("user", null) {

        @Override
        public ProjectsData getProjectsData(IDEFacade ideFacade) {
            return projectsData;
        }
    };
    mockUser.setOnline(true);
    myMockUserListComponent.setSelectedNodes(new User[] { mockUser });
    myFacadeMock.expects(once()).method("showMessage");
    myCommand.execute();
}
Also used : ProjectsData(jetbrains.communicator.core.vfs.ProjectsData) IDEFacade(jetbrains.communicator.ide.IDEFacade) MockUser(jetbrains.communicator.mock.MockUser)

Example 14 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class ShowDiffCommandTest method testEnabled.

public void testEnabled() throws Exception {
    assertFalse(myCommand.isEnabled());
    myCommand.setUser(new MockUser());
    assertFalse(myCommand.isEnabled());
    VFile vFile = VFile.create("a path");
    myCommand.setVFile(vFile);
    myFacadeMock.expects(once()).method("hasFile").with(eq(vFile)).will(returnValue(false));
    assertFalse(myCommand.isEnabled());
    myFacadeMock.expects(once()).method("hasFile").with(eq(vFile)).will(returnValue(true));
    assertTrue(myCommand.isEnabled());
}
Also used : MockUser(jetbrains.communicator.mock.MockUser) VFile(jetbrains.communicator.core.vfs.VFile)

Example 15 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class ShowDiffCommandTest method testExecute.

public void testExecute() throws Exception {
    final VFile vFile = VFile.create("a file");
    MockUser user = new MockUser() {

        @Override
        public String getVFile(VFile file, IDEFacade ideFacade) {
            assertSame(vFile, file);
            return "something";
        }
    };
    myCommand.setUser(user);
    myCommand.setVFile(vFile);
    myFacadeMock.expects(once()).method("showDiffFor").with(eq(user), eq(vFile), eq("something"));
    myCommand.execute();
}
Also used : IDEFacade(jetbrains.communicator.ide.IDEFacade) VFile(jetbrains.communicator.core.vfs.VFile) MockUser(jetbrains.communicator.mock.MockUser)

Aggregations

MockUser (jetbrains.communicator.mock.MockUser)55 User (jetbrains.communicator.core.users.User)13 VFile (jetbrains.communicator.core.vfs.VFile)5 IDEFacade (jetbrains.communicator.ide.IDEFacade)5 MockIDEFacade (jetbrains.communicator.mock.MockIDEFacade)4 AddOnlineUserP2PCommand (jetbrains.communicator.p2p.commands.AddOnlineUserP2PCommand)4 TreeNode (javax.swing.tree.TreeNode)3 CodePointer (jetbrains.communicator.core.vfs.CodePointer)3 ProjectsData (jetbrains.communicator.core.vfs.ProjectsData)3 EventBroadcaster (jetbrains.communicator.core.EventBroadcaster)2 BaseUserImpl (jetbrains.communicator.core.impl.users.BaseUserImpl)2 UserModelImpl (jetbrains.communicator.core.impl.users.UserModelImpl)2 UserEvent (jetbrains.communicator.core.users.UserEvent)2 WaitFor (jetbrains.communicator.util.WaitFor)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Vector (java.util.Vector)1 TreePath (javax.swing.tree.TreePath)1 LocalMessageDispatcherImpl (jetbrains.communicator.core.impl.dispatcher.LocalMessageDispatcherImpl)1 MockMessage (jetbrains.communicator.mock.MockMessage)1