assertEquals(true, getGen(selection).hasPyCode());
assertEquals("(pycode1, pycode2, (pycode_inner1, pycode_inner2))", getGen(selection).getPyCode());
}
public void testSafeRunner() {
IScriptConsoleCodeGenerator generator = new TestExceptionObject();
try {
generator.hasPyCode();
fail();
} catch (RuntimeException e) {
assertEquals("hasPyCode Forced Failure", e.getMessage());
}
try {
generator.getPyCode();
fail();
} catch (RuntimeException e) {
assertEquals("getPyCode Forced Failure", e.getMessage());
}
IScriptConsoleCodeGenerator wrapped = new SafeScriptConsoleCodeGenerator(generator);
assertEquals(false, wrapped.hasPyCode());
assertEquals(null, wrapped.getPyCode());
StructuredSelection selection = new StructuredSelection(generator);
IScriptConsoleCodeGenerator wrappedSelection = new SafeScriptConsoleCodeGenerator(getGen(selection));
assertEquals(false, wrappedSelection.hasPyCode());
assertEquals(null, wrappedSelection.getPyCode());
}