use of jetbrains.communicator.core.EventBroadcaster 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.core.EventBroadcaster 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]);
}
Aggregations