@Test( expected = ValueFormatException.class )
public void shouldNotAllowInvalidNameValue() throws Exception {

    NodeType constrainedType = validateTypeDefinition();
    JcrPropertyDefinition prop = propertyDefinitionFor(constrainedType, TestLexicon.CONSTRAINED_NAME);
    assertThat(prop.satisfiesConstraints(valueFor("system", PropertyType.NAME), session), is(false));
    assertThat(prop.satisfiesConstraints(valueFor("jcr:system2", PropertyType.NAME), session), is(false));
    // Test that old names fail after namespace remaps
    session.setNamespacePrefix("newprefix", TestLexicon.Namespace.URI);
    assertThat(prop.satisfiesConstraints(valueFor("modetest:constrainedType", PropertyType.NAME), session), is(false));
}