Search in sources :

Example 1 with PeriodTestEntity

use of org.apache.cayenne.testdo.java8.PeriodTestEntity in project cayenne by apache.

the class Java8TimeIT method testJava8Period.

@Test
public void testJava8Period() {
    PeriodTestEntity periodTestEntity = context.newObject(PeriodTestEntity.class);
    Period period = Period.of(100, 10, 5);
    periodTestEntity.setPeriodField(period);
    context.commitChanges();
    PeriodTestEntity testRead = ObjectSelect.query(PeriodTestEntity.class).selectOne(context);
    assertNotNull(testRead.getPeriodField());
    assertEquals(Period.class, testRead.getPeriodField().getClass());
    assertEquals(period, testRead.getPeriodField());
}
Also used : Period(java.time.Period) PeriodTestEntity(org.apache.cayenne.testdo.java8.PeriodTestEntity) Test(org.junit.Test)

Aggregations

Period (java.time.Period)1 PeriodTestEntity (org.apache.cayenne.testdo.java8.PeriodTestEntity)1 Test (org.junit.Test)1