use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ExecuteRequestHandlerTest method handleMessage_firstSentMessageHasIdentities.
@Test
public void handleMessage_firstSentMessageHasIdentities() throws Exception {
// given
String expectedIdentities = new String(message.getIdentities().get(0));
// when
executeRequestHandler.handle(message);
waitForIdleMessage(kernel);
// then
assertThat(kernel.getPublishedMessages()).isNotEmpty();
Message publishMessage = kernel.getPublishedMessages().get(0);
assertThat(new String(publishMessage.getIdentities().get(0))).isEqualTo(expectedIdentities);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class MessageCreatorNoResultTest method noResult.
@Test
public void noResult() throws Exception {
// given
SimpleEvaluationObject seo = new SimpleEvaluationObject("code");
seo.setJupyterMessage(new Message());
seo.finished(OutputCell.HIDDEN);
// when
List<MessageHolder> messages = MessageCreator.createMessage(seo);
// then
messages.forEach(m -> assertThat(JupyterMessages.EXECUTE_RESULT).isNotEqualTo(m.getMessage().type()));
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class CodeFactoryTest method shouldBuildCodeWithCombinationOfCodeAndMagic.
@Test
public void shouldBuildCodeWithCombinationOfCodeAndMagic() {
// given
String codeAsString = "" + "println(1)\n" + "%time 1+1\n" + "println(2)\n" + "%time 1+2\n";
// when
Code code = CodeFactory.create(codeAsString, new Message(), kernel);
// then
assertThat(code.getCodeFrames().size()).isEqualTo(4);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class CodeFactoryTest method shouldNotModifyCode.
@Test
public void shouldNotModifyCode() {
String codeAsString = "%time println(\"x y\")";
// when
Code code = CodeFactory.create(codeAsString, new Message(), kernel);
// then
assertThat(((MagicCommand) code.getCodeFrames().get(0)).getCommand()).isEqualTo(codeAsString);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class MagicCommandResultOrderTest method classpathAddJarShouldBeLast.
@Test
public void classpathAddJarShouldBeLast() {
// given
String allCode = "" + "%classpath\n" + "%classpath add jar " + DOC_CONTENTS_DEMO_RESOURCES_BEAKERX_TEST_LIBRARY_JAR + "\n";
Code code = CodeFactory.create(allCode, new Message(), kernel);
// when
code.execute(kernel, 1);
// then
MagicCommand actual = (MagicCommand) code.getCodeFrames().get(1);
assertThat(actual.getCommand()).contains("%classpath add jar");
}
Aggregations