use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class PersistentUserModelImplTest method testAddAndChangeUser.
public void testAddAndChangeUser() throws Exception {
myUserModel.addUser(new MockUser("user", "group"));
checkSaved(true);
User user = myUserModel.getAllUsers()[0];
user.setDisplayName("dds dds", myUserModel);
checkSaved(true);
user.setGroup("newGroup", myUserModel);
checkSaved(true);
user.setCanAccessMyFiles(true, myUserModel);
checkSaved(true);
getBroadcaster().fireEvent(new UserEvent.Updated(user, "presence", null, null));
checkSaved(false);
PersistentUserModelImpl modelInstance = createModelInstance();
User[] users = modelInstance.getAllUsers();
assertEquals(1, users.length);
assertEquals("dds dds", users[0].getDisplayName());
assertEquals("newGroup", users[0].getGroup());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class UserModelImplTest method testRemoveUser.
public void testRemoveUser() throws Exception {
MockUser user = new MockUser("user", null);
myUserModel.addUser(user);
myListener.clear();
myUserModel.removeUser(user);
myListener.assertLog("Expect messages", "BeforeAfter");
myUserModel.removeUser(user);
myListener.assertLog("Expect no messages when not in model", "");
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class UserModelImplTest method testRemoveGroups.
public void testRemoveGroups() throws Exception {
assertFalse(myUserModel.removeGroup("group"));
myUserModel.addGroup("added1");
myUserModel.addGroup("added2");
final MockUser addedUser = new MockUser("some addedUser", "added2");
myUserModel.addUser(addedUser);
assertTrue("Do not contain users, can be removed", myUserModel.removeGroup("added1"));
assertTrue("Contains users, removed including users", myUserModel.removeGroup("group1"));
assertEquals("Wrong groups after deletion", Arrays.asList(new Object[] { "added2", "group2" }), Arrays.asList(myUserModel.getGroups()));
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class SendCodePointerCommandTest method testExecute_Cancel.
public void testExecute_Cancel() throws Exception {
final boolean[] sent = new boolean[1];
MockUser user = new MockUser() {
@Override
public void sendCodeIntervalPointer(VFile file, CodePointer pointer, String comment, EventBroadcaster eventBroadcaster) {
sent[0] = true;
}
};
myCommand.setCodePointer(new CodePointer(0, 0));
myCommand.setVFile(VFile.create("a path"));
myCommand.setUser(user);
myFacadeMock.expects(once()).method("getMessage").will(returnValue(null));
myCommand.execute();
assertFalse("Should call sendCodeIntervalPointer", sent[0]);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class SendCodePointerCommandTest method testEnabled.
public void testEnabled() throws Exception {
assertFalse(myCommand.isEnabled());
myCommand.setCodePointer(new CodePointer(0, 0));
assertFalse(myCommand.isEnabled());
myCommand.setVFile(VFile.create("a path"));
assertFalse(myCommand.isEnabled());
myCommand.setUser(new MockUser());
assertTrue("Now codePointer, file, user are selected - ready to send", myCommand.isEnabled());
}
Aggregations