XPathParser { protected SchemaAttributeTest parseSchemaAttributeTest( TokenStream tokens ) { if (tokens.canConsume("schema-attribute", "(")) { NameTest attributeDeclarationName = parseNameTest(tokens); SchemaAttributeTest result = new SchemaAttributeTest(attributeDeclarationName); tokens.consume(")"); return result; } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }
@Test public void shouldParseSchemaAttributeTest() { SchemaAttributeTest result = parser.parseSchemaAttributeTest(tokenize("schema-attribute(foo)")); assertThat(result, is(notNullValue())); assertThat(result.getAttributeDeclarationName(), is(nameTest("foo"))); result = parser.parseSchemaAttributeTest(tokenize("schema-attribute(foo:bar)")); assertThat(result, is(notNullValue())); assertThat(result.getAttributeDeclarationName(), is(nameTest("foo", "bar"))); result = parser.parseSchemaAttributeTest(tokenize("schema-attribute(*)")); assertThat(result, is(notNullValue())); assertThat(result.getAttributeDeclarationName(), is(wildcard())); }
@Test public void shouldReturnNullFromParseSchemaAttributeTestIfOpenParenthesisIsNotIncluded() { SchemaAttributeTest result = parser.parseSchemaAttributeTest(tokenize("schema-attribute foo")); assertThat(result, is(nullValue())); }