use of org.eclipse.rdf4j.model.Literal in project rdf4j by eclipse.
the class LiteralsTest method testCreateLiteralObjectByte.
/**
* Test method for
* {@link org.eclipse.rdf4j.model.util.Literals#createLiteral(org.eclipse.rdf4j.model.ValueFactory, java.lang.Object)}
* .
*/
@Test
public void testCreateLiteralObjectByte() throws Exception {
Object obj = new Integer(42).byteValue();
Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj);
assertNotNull(l);
assertEquals(l.getDatatype(), XMLSchema.BYTE);
assertEquals(l.getLabel(), "42");
}
use of org.eclipse.rdf4j.model.Literal in project rdf4j by eclipse.
the class LiteralsTest method testCreateLiteralOrFailObjectFloat.
/**
* Test method for
* {@link org.eclipse.rdf4j.model.util.Literals#createLiteralOrFail(org.eclipse.rdf4j.model.ValueFactory, java.lang.Object)}
* .
*/
@Test
public void testCreateLiteralOrFailObjectFloat() throws Exception {
Object obj = new Float(42);
Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj);
assertNotNull(l);
assertEquals(l.getDatatype(), XMLSchema.FLOAT);
assertEquals(l.getLabel(), "42.0");
}
use of org.eclipse.rdf4j.model.Literal in project rdf4j by eclipse.
the class LiteralsTest method testCreateLiteralOrFailObjectDouble.
/**
* Test method for
* {@link org.eclipse.rdf4j.model.util.Literals#createLiteralOrFail(org.eclipse.rdf4j.model.ValueFactory, java.lang.Object)}
* .
*/
@Test
public void testCreateLiteralOrFailObjectDouble() throws Exception {
Object obj = new Double(42);
Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj);
assertNotNull(l);
assertEquals(l.getDatatype(), XMLSchema.DOUBLE);
assertEquals(l.getLabel(), "42.0");
}
use of org.eclipse.rdf4j.model.Literal in project rdf4j by eclipse.
the class LiteralsTest method testCreateLiteralOrFailObjectDate.
/**
* Test method for
* {@link org.eclipse.rdf4j.model.util.Literals#createLiteralOrFail(org.eclipse.rdf4j.model.ValueFactory, java.lang.Object)}
* .
*/
@Test
public void testCreateLiteralOrFailObjectDate() throws Exception {
Object obj = new Date();
Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj);
assertNotNull(l);
assertEquals(l.getDatatype(), XMLSchema.DATETIME);
}
use of org.eclipse.rdf4j.model.Literal in project rdf4j by eclipse.
the class LiteralsTest method testCreateLiteralOrFailObjectShort.
/**
* Test method for
* {@link org.eclipse.rdf4j.model.util.Literals#createLiteralOrFail(org.eclipse.rdf4j.model.ValueFactory, java.lang.Object)}
* .
*/
@Test
public void testCreateLiteralOrFailObjectShort() throws Exception {
Object obj = Short.parseShort("42");
Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj);
assertNotNull(l);
assertEquals(l.getDatatype(), XMLSchema.SHORT);
assertEquals("42", l.getLabel());
}
Aggregations