use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class SendCodePointerCommandTest method testExecute_WithMessage.
public void testExecute_WithMessage() throws Exception {
final CodePointer codePointerToSend = new CodePointer(0, 0);
final VFile fileToSend = VFile.create("a path");
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;
assertSame(fileToSend, file);
assertSame(codePointerToSend, pointer);
assertEquals("some message", comment);
}
};
myCommand.setCodePointer(codePointerToSend);
myCommand.setVFile(fileToSend);
myCommand.setUser(user);
myFacadeMock.expects(once()).method("getMessage").will(returnValue("some message"));
myFacadeMock.expects(once()).method("fillFileContents").with(eq(fileToSend));
myCommand.execute();
assertTrue("Should call sendCodeIntervalPointer", sent[0]);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class SendMessageCommandTest method testInvokeDialogWithExplicitUser.
public void testInvokeDialogWithExplicitUser() throws Exception {
MockUser user1 = new MockUser();
myUserModel.addUser(user1);
myCommand.setUser(user1);
myFacadeMock.expects(once()).method("invokeSendMessage").with(eq(myUserModel.getAllUsers()), eq(new User[] { user1 }), eq(""), ANYTHING);
myCommand.execute();
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class SendMessageCommandTest method testInvokeDialog.
public void testInvokeDialog() throws Exception {
MockUser user1 = new MockUser("user1", null);
MockUser user2 = new MockUser("user2", null);
MockUser user3 = new MockUser("user3", null);
myUserModel.addUser(user1);
myUserModel.addUser(user2);
myUserModel.addUser(user3);
myMockUserListComponent.setSelectedNodes(new Object[] { "a group", user2, "grp2", user1 });
myCommand.setMessage("a text");
myFacadeMock.expects(once()).method("invokeSendMessage").with(eq(myUserModel.getAllUsers()), eq(new User[] { user2, user1 }), eq("a text"), ANYTHING);
myCommand.execute();
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class ShowDiffCommandTest method testExecute_NoContent.
public void testExecute_NoContent() 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 null;
}
};
myCommand.setUser(user);
myCommand.setVFile(vFile);
myCommand.execute();
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class DeleteCommandTest method testDeleteGroup_WithUsers_DeleteAll.
public void testDeleteGroup_WithUsers_DeleteAll() throws Exception {
myUserModel.addGroup(GROUP_NAME);
MockUser user = new MockUser("user", GROUP_NAME);
myUserModel.addUser(user);
myUserListComponentMock.stubs().method("getSelectedNodes").will(returnValue(new Object[] { GROUP_NAME, user }));
assertTrue("Want to delete group with users in it", myCommand.isEnabled());
myIDEFacade.expects(once()).method("askQuestion").will(returnValue(true));
myCommand.execute();
assertEquals(0, myUserModel.getAllUsers().length);
assertEquals(0, myUserModel.getGroups().length);
}
Aggregations