InterpreterResult implements Serializable { public String message() { return msg; } InterpreterResult(Code code);  InterpreterResult(Code code, String msg);  InterpreterResult(Code code, Type type, String msg); Code code(); String message(); Type type(); InterpreterResult type(Type type); String toString();  }
@Test public void testSimpleMagicData() { InterpreterResult result = null; result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%table col1\tcol2\naaa\t123\n"); assertEquals("%table col1\tcol2\naaa\t123\n","col1\tcol2\naaa\t123\n", result.message()); result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%table\ncol1\tcol2\naaa\t123\n"); assertEquals("%table\ncol1\tcol2\naaa\t123\n","col1\tcol2\naaa\t123\n", result.message()); result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"some text before magic word %table col1\tcol2\naaa\t123\n"); assertEquals("some text before magic word %table col1\tcol2\naaa\t123\n","col1\tcol2\naaa\t123\n", result.message()); }
@Test public void testComplexMagicData() { InterpreterResult result = null; result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"some text before %table col1\tcol2\naaa\t123\n"); assertEquals("text before %table return %table","col1\tcol2\naaa\t123\n", result.message()); result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%html <h3> This is a hack </h3> %table\ncol1\tcol2\naaa\t123\n"); assertEquals("%html before %table return %html"," <h3> This is a hack </h3> %table\n" + "col1\tcol2\n" + "aaa\t123\n", result.message()); result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"some text before magic word %table col1\tcol2\naaa\t123\n %html <h3> This is a hack </h3>"); assertEquals("text & %table befoe %html return %table","col1\tcol2\n" + "aaa\t123\n" + " %html <h3> This is a hack </h3>", result.message()); result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%table col1\tcol2\naaa\t123\n %html <h3> This is a hack </h3> %table col1\naaa\n123\n"); assertEquals("%table, %html before %table return first %table","col1\tcol2\n" + "aaa\t123\n" + " %html <h3> This is a hack </h3> %table col1\n" + "aaa\n" + "123\n", result.message()); result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%table col1\tcol2\naaa\t123\n %table col1\naaa\n123\n"); assertEquals("%table before %table return first %table","col1\tcol2\n" + "aaa\t123\n" + " %table col1\n" + "aaa\n" + "123\n", result.message()); }