use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class ViewFilesCommandTest method testExecute_WithInformation.
public void testExecute_WithInformation() throws Exception {
final ProjectsData projectsData = new ProjectsData();
projectsData.addNonProjectFile(VFile.create("a path"));
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("showUserFiles").with(eq(mockUser), eq(projectsData));
myCommand.execute();
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class ViewFilesCommandTest method testIsEnabled.
public void testIsEnabled() throws Exception {
assertFalse(myCommand.isEnabled());
myMockUserListComponent.setSelectedNodes(new Object[] { "group" });
assertFalse(myCommand.isEnabled());
MockUser mockUser = new MockUser("user", null);
myMockUserListComponent.setSelectedNodes(new User[] { mockUser });
assertFalse("User is offline", myCommand.isEnabled());
mockUser.setOnline(true);
mockUser.setIDEtalkUser(false);
assertFalse("Single user selected and online but not IDEtalk user- command should be disabled", myCommand.isEnabled());
mockUser.setIDEtalkUser(true);
assertTrue("Single user selected and online and IDEtalk user- command should be disabled", myCommand.isEnabled());
myMockUserListComponent.setSelectedNodes(new User[] { mockUser, mockUser });
assertFalse("Two users are selected", myCommand.isEnabled());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class FoundUsersModelTest method testUserWithoutProject.
public void testUserWithoutProject() throws Exception {
MockUser bob = new MockUser("BobName", null);
FoundUsersModel model = createModel(Arrays.asList(new User[] { bob }));
assertEquals("One (unnamed) project expected", 1, getRoot(model).getChildCount());
TreeNode projectNode = getRoot(model).getChildAt(0);
assertEquals("Invalid project node", "<no project>", projectNode.toString());
assertEquals("One user in group expected", 1, projectNode.getChildCount());
assertEquals("Invalid user node", bob.getName(), projectNode.getChildAt(0).toString());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class FoundUsersModelTest method test2Users2Projects.
public void test2Users2Projects() throws Exception {
MockUser bob = new MockUser("bob", null);
MockUser alice = new MockUser("alice", null);
bob.setProjects(new String[] { "bobProject" });
alice.setProjects(new String[] { "aliceProject" });
FoundUsersModel model = createModel(Arrays.asList(new User[] { bob, alice }));
assertEquals("Two projects expected", 2, getRoot(model).getChildCount());
assertEquals("One user per project expected", 1, getRoot(model).getChildAt(0).getChildCount());
assertEquals("One user per project expected", 1, getRoot(model).getChildAt(1).getChildCount());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class UserModelImplTest method testAddUser.
public void testAddUser() throws Exception {
MockUser user = new MockUser("user", null);
myUserModel.addUser(user);
assertTrue(myUserModel.hasUser(user));
myListener.assertLog("Expect messages", "BeforeAfter");
myUserModel.addUser(user);
myListener.assertLog("Expect no messages when already in model", "");
}
Aggregations