XPathParser { protected SchemaElementTest parseSchemaElementTest( TokenStream tokens ) { if (tokens.canConsume("schema-element", "(")) { NameTest elementDeclarationName = parseNameTest(tokens); SchemaElementTest result = new SchemaElementTest(elementDeclarationName); tokens.consume(")"); return result; } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }
@Test public void shouldParseSchemaElementTest() { SchemaElementTest result = parser.parseSchemaElementTest(tokenize("schema-element(foo)")); assertThat(result, is(notNullValue())); assertThat(result.getElementDeclarationName(), is(nameTest("foo"))); result = parser.parseSchemaElementTest(tokenize("schema-element(foo:bar)")); assertThat(result, is(notNullValue())); assertThat(result.getElementDeclarationName(), is(nameTest("foo", "bar"))); result = parser.parseSchemaElementTest(tokenize("schema-element(*)")); assertThat(result, is(notNullValue())); assertThat(result.getElementDeclarationName(), is(wildcard())); }
@Test public void shouldReturnNullFromParseSchemaElementTestIfOpenParenthesisIsNotIncluded() { SchemaElementTest result = parser.parseSchemaElementTest(tokenize("schema-element foo")); assertThat(result, is(nullValue())); }