Repository: zeppelin Updated Branches: refs/heads/master 802bf5041 -> 307049a9e
[MINOR] Format Fix for InterpreterResultTest.java ### What is this PR for? Java code style format fix. Seems lots of tabs are in the source code ### What type of PR is it? [Improvement] ### Todos * [ ] - Task ### What is the Jira issue? * No jira created ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jeff Zhang <[email protected]> Closes #1413 from zjffdu/format_fix and squashes the following commits: 7e85e49 [Jeff Zhang] [MINOR]Format Fix for InterpreterResultTest.java Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/307049a9 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/307049a9 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/307049a9 Branch: refs/heads/master Commit: 307049a9ecffade6af5ab7c28bb9c4ad8e2c8612 Parents: 802bf50 Author: Jeff Zhang <[email protected]> Authored: Thu Sep 8 12:40:59 2016 +0800 Committer: Lee moon soo <[email protected]> Committed: Tue Sep 13 11:21:23 2016 -0700 ---------------------------------------------------------------------- .../interpreter/InterpreterResultTest.java | 164 +++++++++---------- 1 file changed, 81 insertions(+), 83 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/307049a9/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/InterpreterResultTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/InterpreterResultTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/InterpreterResultTest.java index d7ab9e8..69e972b 100644 --- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/InterpreterResultTest.java +++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/InterpreterResultTest.java @@ -23,91 +23,89 @@ import static org.junit.Assert.fail; import org.junit.Test; +public class InterpreterResultTest { + @Test + public void testTextType() { -public class InterpreterResultTest { + InterpreterResult result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "this is a TEXT type"); + assertEquals("No magic", InterpreterResult.Type.TEXT, result.type()); + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "%this is a TEXT type"); + assertEquals("No magic", InterpreterResult.Type.TEXT, result.type()); + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "%\n"); + assertEquals("No magic", InterpreterResult.Type.TEXT, result.type()); + } + + @Test + public void testSimpleMagicType() { + InterpreterResult result = null; + + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "%table col1\tcol2\naaa\t123\n"); + assertEquals(InterpreterResult.Type.TABLE, result.type()); + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "%table\ncol1\tcol2\naaa\t123\n"); + assertEquals(InterpreterResult.Type.TABLE, result.type()); + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "some text before magic word %table col1\tcol2\naaa\t123\n"); + assertEquals(InterpreterResult.Type.TABLE, result.type()); + } + + public void testComplexMagicType() { + InterpreterResult result = null; + + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "some text before %table col1\tcol2\naaa\t123\n"); + assertEquals("some text before magic return magic", InterpreterResult.Type.TABLE, result.type()); + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "%html <h3> This is a hack </h3> %table\n col1\tcol2\naaa\t123\n"); + assertEquals("magic A before magic B return magic A", InterpreterResult.Type.HTML, result.type()); + 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 & magic A before magic B return magic A", InterpreterResult.Type.TABLE, result.type()); + 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("magic A, magic B, magic a' return magic A", InterpreterResult.Type.TABLE, result.type()); + } + + @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()); + } - @Test - public void testTextType() { - - InterpreterResult result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"this is a TEXT type"); - assertEquals("No magic",InterpreterResult.Type.TEXT, result.type()); - result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%this is a TEXT type"); - assertEquals("No magic",InterpreterResult.Type.TEXT, result.type()); - result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%\n"); - assertEquals("No magic",InterpreterResult.Type.TEXT, result.type()); - } - @Test - public void testSimpleMagicType() { - InterpreterResult result = null; - - result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%table col1\tcol2\naaa\t123\n"); - assertEquals(InterpreterResult.Type.TABLE, result.type()); - result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%table\ncol1\tcol2\naaa\t123\n"); - assertEquals(InterpreterResult.Type.TABLE, result.type()); - result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"some text before magic word %table col1\tcol2\naaa\t123\n"); - assertEquals(InterpreterResult.Type.TABLE, result.type()); - } - - public void testComplexMagicType() { - InterpreterResult result = null; - - result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"some text before %table col1\tcol2\naaa\t123\n"); - assertEquals("some text before magic return magic",InterpreterResult.Type.TABLE, result.type()); - result = new InterpreterResult(InterpreterResult.Code.SUCCESS,"%html <h3> This is a hack </h3> %table\n col1\tcol2\naaa\t123\n"); - assertEquals("magic A before magic B return magic A",InterpreterResult.Type.HTML, result.type()); - 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 & magic A before magic B return magic A" ,InterpreterResult.Type.TABLE, result.type()); - 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("magic A, magic B, magic a' return magic A" ,InterpreterResult.Type.TABLE, result.type()); - - } - - @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()); - } - - @Test - public void testToString() { - assertEquals("%html hello", new InterpreterResult(InterpreterResult.Code.SUCCESS, "%html hello").toString()); - } + @Test + public void testToString() { + assertEquals("%html hello", new InterpreterResult(InterpreterResult.Code.SUCCESS, "%html hello").toString()); + } }
