use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class SetValueValueFormatExceptionTest method testNodeNotReferenceable.
/**
* Tests if setValue(Node) throws a ValueFormatException immediately (not
* on save) if the specified node is not referencable.
*/
public void testNodeNotReferenceable() throws NotExecutableException, RepositoryException {
if (testRootNode.isNodeType(mixReferenceable)) {
throw new NotExecutableException("test requires testRootNode to be non-referenceable");
}
Property referenceProperty = createProperty(PropertyType.REFERENCE, false);
try {
referenceProperty.setValue(testRootNode);
fail("Property.setValue(Node) must throw a ValueFormatException " + "immediately if the specified node is not referenceable.");
} catch (ValueFormatException e) {
// success
}
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class SetValueValueFormatExceptionTest method testValueArray.
/**
* Tests if setValue(Value[]) throws a ValueFormatException immediately (not
* on save) if a conversion fails.
*/
public void testValueArray() throws NotExecutableException, RepositoryException {
Property booleanProperty = createProperty(PropertyType.BOOLEAN, true);
try {
Value[] dateValues = new Value[] { NodeTypeUtil.getValueOfType(superuser, PropertyType.DOUBLE) };
booleanProperty.setValue(dateValues);
fail("Property.setValue(Value[]) must throw a ValueFormatException " + "immediately if a conversion fails.");
} catch (ValueFormatException e) {
// success
}
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class SetValueValueFormatExceptionTest method testBoolean.
/**
* Tests if setValue(boolean) throws a ValueFormatException immediately (not
* on save) if a conversion fails.
*/
public void testBoolean() throws NotExecutableException, RepositoryException {
Property dateProperty = createProperty(PropertyType.DATE, false);
try {
dateProperty.setValue(true);
fail("Property.setValue(boolean) must throw a ValueFormatException " + "immediately if a conversion fails.");
} catch (ValueFormatException e) {
// success
}
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class SetValueValueFormatExceptionTest method testInputStream.
/**
* Tests if setValue(InputStream) throws a ValueFormatException immediately (not
* on save) if a conversion fails.
*/
public void testInputStream() throws NotExecutableException, RepositoryException {
Property dateProperty = createProperty(PropertyType.DATE, false);
try {
byte[] bytes = { 123 };
InputStream value = new ByteArrayInputStream(bytes);
dateProperty.setValue(value);
fail("Property.setValue(InputStream) must throw a ValueFormatException " + "immediately if a conversion fails.");
} catch (ValueFormatException e) {
// success
}
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class SetValueValueFormatExceptionTest method testValue.
/**
* Tests if setValue(Value) throws a ValueFormatException immediately (not
* on save) if a conversion fails.
*/
public void testValue() throws NotExecutableException, RepositoryException {
Property booleanProperty = createProperty(PropertyType.BOOLEAN, false);
try {
Value dateValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DATE);
booleanProperty.setValue(dateValue);
fail("Property.setValue(Value) must throw a ValueFormatException " + "immediately if a conversion fails.");
} catch (ValueFormatException e) {
// success
}
}
Aggregations