XPathParser { protected TextTest parseTextTest( TokenStream tokens ) { if (tokens.canConsume("text", "(", ")")) { return new TextTest(); } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }
@Test public void shouldParseTextTest() { assertThat(parser.parseTextTest(tokenize("text()")), is(instanceOf(TextTest.class))); }
@Test public void shouldReturnNullFromParseTextTestIfNotFollowedByOpenAndCloseParenthesis() { assertThat(parser.parseTextTest(tokenize("text x )")), is(nullValue())); assertThat(parser.parseTextTest(tokenize("text(x )")), is(nullValue())); assertThat(parser.parseTextTest(tokenize("text(x")), is(nullValue())); }