protected void assertProperty( AbstractJcrProperty property, javax.jcr.Node node, String name, int propertyType, Object... values) throws Exception { assertThat(property.getName(), is(name)); assertThat(property.getType(), is(propertyType)); assertThat(property.getParent(), is(node)); if (values.length > 1) { int i = 0; for (Value actual : property.getValues()) { String actualString = actual.getString(); String expectedString = context.getValueFactories().getStringFactory().create(values[i]); assertThat(actualString, is(expectedString)); assertCanObtainValue(actual, propertyType); ++i; } // Getting the single value should result in an error ... try { property.getValue(); fail("Should not be able to call Property.getValue() on multi-valued properties"); } catch (ValueFormatException e) { // expected ... } } else { String actualString = property.getValue().getString(); String expectedString = context.getValueFactories().getStringFactory().create(values[0]); assertThat(actualString, is(expectedString)); assertThat(actualString, is(property.getString())); assertCanObtainValue(property.getValue(), propertyType); // Getting the multiple values should result in an error ... try { property.getValues(); fail("Should not be able to call Property.getValues() on single-valued properties"); } catch (ValueFormatException e) { // expected ... } // Check resolving the reference ... if (propertyType == PropertyType.REFERENCE) { javax.jcr.Node referenced = property.getNode(); assertThat(referenced, is(notNullValue())); } } }