use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class SimpleValueFactoryTest method testString.
public void testString() throws RepositoryException {
String a = "test";
Value value = factory.createValue(a);
assertEquals(PropertyType.STRING, value.getType());
assertEquals(value, factory.createValue(a));
assertFalse(value.getBoolean());
try {
value.getDate();
fail();
} catch (ValueFormatException e) {
}
try {
value.getDecimal();
fail();
} catch (ValueFormatException e) {
}
try {
value.getDouble();
fail();
} catch (ValueFormatException e) {
}
try {
value.getLong();
fail();
} catch (ValueFormatException e) {
}
assertEquals(a, value.getString());
// TODO: binary representation
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class BooleanPropertyTest method testGetLong.
/**
* Tests failure of conversion from Boolean type to Long type.
*/
public void testGetLong() throws RepositoryException {
try {
Value val = PropertyUtil.getValue(prop);
val.getLong();
fail("Conversion from a Boolean value to a Long value " + "should throw a ValueFormatException");
} catch (ValueFormatException vfe) {
// ok
}
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class BooleanPropertyTest method testGetDouble.
/**
* Tests failure from Boolean type to Double type.
*/
public void testGetDouble() throws RepositoryException {
try {
Value val = PropertyUtil.getValue(prop);
val.getDouble();
fail("Conversion from a Boolean value to a Double value " + "should throw a ValueFormatException");
} catch (ValueFormatException vfe) {
// ok
}
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class BooleanPropertyTest method testGetDate.
/**
* Tests failure of conversion from Boolean type to Date type.
*/
public void testGetDate() throws RepositoryException {
try {
Value val = PropertyUtil.getValue(prop);
val.getDate();
fail("Conversion from a Boolean value to a Date value " + "should throw a ValueFormatException");
} catch (ValueFormatException vfe) {
// ok
}
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class BinaryPropertyTest method testMultiValue.
/**
* Tests the failure of calling Property.getStream() on a multivalue
* property.
*/
public void testMultiValue() throws RepositoryException, IOException {
if (multiple) {
InputStream in = null;
try {
in = prop.getStream();
fail("Calling getStream() on a multivalue property " + "should throw a ValueFormatException.");
} catch (ValueFormatException vfe) {
// ok
} finally {
if (in != null) {
in.close();
}
}
}
}
Aggregations