@Test
  public void testBasicIntp() {
    assertEquals(
        InterpreterResult.Code.SUCCESS, repl.interpret("val a = 1\nval b = 2", context).code());

    // when interpret incomplete expression
    InterpreterResult incomplete = repl.interpret("val a = \"\"\"", context);
    assertEquals(InterpreterResult.Code.INCOMPLETE, incomplete.code());
    assertTrue(incomplete.message().length() > 0); // expecting some error
    // message
  }
  @Before
  public void setUp() throws Exception {
    tmpDir =
        new File(
            System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis());
    System.setProperty("zeppelin.dep.localrepo", tmpDir.getAbsolutePath() + "/local-repo");

    tmpDir.mkdirs();

    if (repl == null) {
      Properties p = new Properties();

      repl = new ScaldingInterpreter(p);
      repl.open();
    }

    InterpreterGroup intpGroup = new InterpreterGroup();
    context =
        new InterpreterContext(
            "note",
            "id",
            "title",
            "text",
            new HashMap<String, Object>(),
            new GUI(),
            new AngularObjectRegistry(intpGroup.getId(), null),
            new LinkedList<InterpreterContextRunner>());
  }
 @Test
 public void testReferencingUndefinedVal() {
   InterpreterResult result =
       repl.interpret(
           "def category(min: Int) = {" + "    if (0 <= value) \"error\"" + "}", context);
   assertEquals(Code.ERROR, result.code());
 }
 @Test
 public void testBasicScalding() {
   assertEquals(
       InterpreterResult.Code.SUCCESS,
       repl.interpret(
               "case class Sale(state: String, name: String, sale: Int)\n"
                   + "val salesList = List(Sale(\"CA\", \"A\", 60), Sale(\"CA\", \"A\", 20), Sale(\"VA\", \"B\", 15))\n"
                   + "val salesPipe = TypedPipe.from(salesList)\n"
                   + "val results = salesPipe.map{x => (1, Set(x.state), x.sale)}.\n"
                   + "    groupAll.sum.values.map{ case(count, set, sum) => (count, set.size, sum) }\n"
                   + "results.dump",
               context)
           .code());
 }
 @After
 public void tearDown() throws Exception {
   delete(tmpDir);
   repl.close();
 }
 @Test
 public void testEndWithComment() {
   assertEquals(
       InterpreterResult.Code.SUCCESS, repl.interpret("val c=1\n//comment", context).code());
 }
 @Test
 public void testNextLineInvocation() {
   assertEquals(InterpreterResult.Code.SUCCESS, repl.interpret("\"123\"\n.toInt", context).code());
 }