Search in sources :

Example 21 with DateTimeStruct

use of org.apache.jena.sparql.util.DateTimeStruct in project jena by apache.

the class TestDateTimeParsing method testGMonthDay_2.

@Test
public void testGMonthDay_2() {
    DateTimeStruct dt = DateTimeStruct.parseGMonthDay("--10-31Z");
    check(dt, null, null, "10", "31", "Z");
}
Also used : DateTimeStruct(org.apache.jena.sparql.util.DateTimeStruct) Test(org.junit.Test)

Example 22 with DateTimeStruct

use of org.apache.jena.sparql.util.DateTimeStruct in project jena by apache.

the class TestDateTimeParsing method dateTest.

private static void dateTest(String str) {
    DateTimeStruct dt = DateTimeStruct.parseDate(str);
    assertFalse(dt.xsdDateTime);
    check(dt);
    assertEquals(str, dt.toString());
}
Also used : DateTimeStruct(org.apache.jena.sparql.util.DateTimeStruct)

Example 23 with DateTimeStruct

use of org.apache.jena.sparql.util.DateTimeStruct in project jena by apache.

the class TestDateTimeParsing method testD_10.

@Test
public void testD_10() {
    DateTimeStruct dt = DateTimeStruct.parseDate("2007-08-31");
    check(dt, null, "2007", "08", "31", null);
}
Also used : DateTimeStruct(org.apache.jena.sparql.util.DateTimeStruct) Test(org.junit.Test)

Example 24 with DateTimeStruct

use of org.apache.jena.sparql.util.DateTimeStruct in project jena by apache.

the class TestDateTimeParsing method dateTimeTest.

// ----
private static void dateTimeTest(String str) {
    DateTimeStruct dt = DateTimeStruct.parseDateTime(str);
    assertTrue(dt.xsdDateTime);
    check(dt);
    assertEquals(str, dt.toString());
}
Also used : DateTimeStruct(org.apache.jena.sparql.util.DateTimeStruct)

Example 25 with DateTimeStruct

use of org.apache.jena.sparql.util.DateTimeStruct in project jena by apache.

the class TestDateTimeParsing method dateBad.

private static void dateBad(String str) {
    try {
        DateTimeStruct dt = DateTimeStruct.parseDateTime(str);
        fail("No exception; " + str);
    } catch (DateTimeStruct.DateTimeParseException ex) {
    }
}
Also used : DateTimeStruct(org.apache.jena.sparql.util.DateTimeStruct)

Aggregations

DateTimeStruct (org.apache.jena.sparql.util.DateTimeStruct)28 Test (org.junit.Test)19 ARQInternalErrorException (org.apache.jena.sparql.ARQInternalErrorException)2 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)1 Node (org.apache.jena.graph.Node)1