XPathParser { protected CommentTest parseCommentTest( TokenStream tokens ) { if (tokens.canConsume("comment", "(", ")")) { return new CommentTest(); } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }
@Test public void shouldParseCommentTest() { assertThat(parser.parseCommentTest(tokenize("comment()")), is(instanceOf(CommentTest.class))); }
@Test public void shouldReturnNullFromParseCommentTestIfNotFollowedByOpenAndCloseParenthesis() { assertThat(parser.parseCommentTest(tokenize("comment x )")), is(nullValue())); assertThat(parser.parseCommentTest(tokenize("comment(x )")), is(nullValue())); assertThat(parser.parseCommentTest(tokenize("comment(x")), is(nullValue())); }