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());
}
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);
}
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();
}
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());
}
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();
}
Aggregations