use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class ImportMagicCommandTest method removeImport.
@Test
public void removeImport() {
// given
String allCode = "%import com.twosigma.beakerx.widget.IntSlider\n";
Code code = CodeFactory.create(allCode, new Message(), kernel);
code.execute(kernel, 1);
assertThat(kernel.getImports().getImportPaths()).contains(new ImportPath("com.twosigma.beakerx.widget.IntSlider"));
// when
String allRemoveCode = "%unimport com.twosigma.beakerx.widget.IntSlider\n";
Code codeToRemove = CodeFactory.create(allRemoveCode, new Message(), kernel);
codeToRemove.execute(kernel, 2);
// then
assertThat(kernel.getImports().getImportPaths()).doesNotContain(new ImportPath("com.twosigma.beakerx.widget.IntSlider"));
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class ClasspathAddRepoMagicCommandTest method addMvnLocalShouldReturnWarningWhenLocalMavenRepositoryNotExist.
@Test
public void addMvnLocalShouldReturnWarningWhenLocalMavenRepositoryNotExist() {
// given
try {
BeakerxSystemProperty.fixUserHome("/home/xxx");
String allCode = CLASSPATH_CONFIG_RESOLVER + " " + MVN_LOCAL;
Code code = CodeFactory.create(allCode, new Message(), kernel);
// when
code.execute(kernel, 1);
// then
List<Message> std = EvaluatorResultTestWatcher.getStdouts(kernel.getPublishedMessages());
String text = (String) std.get(0).getContent().get("text");
assertThat(text).contains("Warning: directory");
} finally {
BeakerxSystemProperty.setSystemUserHome();
}
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class GroovyKernelTest method shouldNotImportStaticUnknownFieldDemoClassByMagicCommand.
@Test
public void shouldNotImportStaticUnknownFieldDemoClassByMagicCommand() throws Exception {
// given
addDemoJar();
String path = pathToDemoClassFromAddedDemoJar() + ".STATIC_TEST_123_unknown";
// when
Code code = CodeFactory.create(ADD_STATIC_IMPORT + " " + path, new Message(), getKernel());
code.execute(kernel, 1);
// then
verifyNotImportedStaticMagicCommand();
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class GroovyKernelTest method shouldNotImportStaticUnknownClassByMagicCommand.
@Test
public void shouldNotImportStaticUnknownClassByMagicCommand() throws Exception {
// given
String allCode = ADD_STATIC_IMPORT + " " + pathToDemoClassFromAddedDemoJar() + "UnknownClass";
// when
Code code = CodeFactory.create(allCode, new Message(), getKernel());
code.execute(kernel, 1);
// then
verifyNotImportedStaticMagicCommand();
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class GroovyKernelTest method shouldNotImportStaticUnknownMethodDemoClassByMagicCommand.
@Test
public void shouldNotImportStaticUnknownMethodDemoClassByMagicCommand() throws Exception {
// given
addDemoJar();
String path = pathToDemoClassFromAddedDemoJar() + ".staticTest_unknown";
// when
Code code = CodeFactory.create(ADD_STATIC_IMPORT + " " + path, new Message(), getKernel());
code.execute(kernel, 1);
// then
verifyNotImportedStaticMagicCommand();
}
Aggregations