Fixed half-baked test.
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/4faaf190 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/4faaf190 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/4faaf190 Branch: refs/heads/master Commit: 4faaf1906820768f96bc22c4d7eaa9cb0738eaf9 Parents: 08ef0dd Author: tdunning <[email protected]> Authored: Wed Oct 17 11:00:30 2012 -0700 Committer: tdunning <[email protected]> Committed: Wed Oct 17 11:00:30 2012 -0700 ---------------------------------------------------------------------- .../java/org/apache/drill/plan/ParsePlanTest.java | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/4faaf190/sandbox/plan-parser/src/test/java/org/apache/drill/plan/ParsePlanTest.java ---------------------------------------------------------------------- diff --git a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/ParsePlanTest.java b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/ParsePlanTest.java index 8ecc7d1..7bbbaf6 100644 --- a/sandbox/plan-parser/src/test/java/org/apache/drill/plan/ParsePlanTest.java +++ b/sandbox/plan-parser/src/test/java/org/apache/drill/plan/ParsePlanTest.java @@ -21,8 +21,10 @@ import com.google.common.base.Charsets; import com.google.common.collect.Lists; import com.google.common.io.Resources; import org.antlr.runtime.ANTLRReaderStream; +import org.antlr.runtime.MissingTokenException; import org.antlr.runtime.RecognitionException; import org.antlr.runtime.Token; +import org.apache.drill.plan.ast.LogicalPlanParseException; import org.apache.drill.plan.ast.Plan; import org.apache.drill.plan.ast.PlanLexer; import org.junit.Test; @@ -69,9 +71,11 @@ public class ParsePlanTest { try { ParsePlan.parseResource("bad-plan2.drillx"); fail("Should have thrown exception"); - } catch (ParsePlan.ValidationException e) { - assertTrue(e.getMessage().contains("%2 used more than once")); - assertTrue(e.getMessage().contains("Undefined reference to %3")); + } catch (LogicalPlanParseException e) { + assertTrue(e.getCause() instanceof MissingTokenException); + MissingTokenException ex = ((MissingTokenException) e.getCause()); + assertEquals(1, ex.line); + assertEquals(6, ex.charPositionInLine); } }
