GrammarDefinition { public Parser build() { return build("start"); }  Parser build(); Parser build(String name);  }
@Test public void testGrammar() { Parser parser = grammarDefinition.build(); assertEquals(Arrays.asList("1", ",", "2"), parser.parse("1,2").get()); assertEquals(Arrays.asList("1", ",", Arrays.asList("2", ",", "3")), parser.parse("1,2,3").get()); }
@Test public void testDelegation1() { assertTrue(buggedDefinition.build("delegation1") instanceof EpsilonParser); }
@Test public void testDelegation2() { assertTrue(buggedDefinition.build("delegation2") instanceof EpsilonParser); }
@Test public void testDelegation3() { assertTrue(buggedDefinition.build("delegation3") instanceof EpsilonParser); }
@Test public void testParser() { Parser parser = parserDefinition.build(); assertEquals(Arrays.asList(1, ",", 2), parser.parse("1,2").get()); assertEquals(Arrays.asList(1, ",", Arrays.asList(2, ",", 3)), parser.parse("1,2,3").get()); }
@Test(expected = IllegalStateException.class) public void testDirectRecursion1() { buggedDefinition.build("directRecursion1"); }
@Test(expected = IllegalStateException.class) public void testIndirectRecursion1() { buggedDefinition.build("indirectRecursion1"); }
@Test(expected = IllegalStateException.class) public void testIndirectRecursion2() { buggedDefinition.build("indirectRecursion2"); }
@Test(expected = IllegalStateException.class) public void testIndirectRecursion3() { buggedDefinition.build("indirectRecursion3"); }
@Test(expected = IllegalStateException.class) public void testUnknownReferenceOutside() { buggedDefinition.build("unknown"); }
@Test(expected = IllegalStateException.class) public void testUnknownReferenceInside() { buggedDefinition.build("unknownReference"); }