use of org.minijax.db.test.Widget in project minijax by minijax.
the class BaseEntityTest method testCopyPropertiesDifferentClass.
@Test(expected = IllegalArgumentException.class)
public void testCopyPropertiesDifferentClass() {
final Widget w = new Widget();
w.copyNonNullProperties(new DifferentEntity());
}
use of org.minijax.db.test.Widget in project minijax by minijax.
the class BaseEntityTest method testSortByCreatedDate.
@Test
public void testSortByCreatedDate() {
final Widget w1 = new Widget();
w1.setCreatedDateTime(Instant.now().minusSeconds(3L));
final Widget w2 = new Widget();
w2.setCreatedDateTime(Instant.now().minusSeconds(2L));
final Widget w3 = new Widget();
w3.setCreatedDateTime(Instant.now().minusSeconds(1L));
final List<Widget> w = new ArrayList<>(Arrays.asList(w3, w2, w1));
BaseEntity.sortByCreatedDateTime(w);
assertEquals(w1, w.get(0));
assertEquals(w2, w.get(1));
assertEquals(w3, w.get(2));
}
use of org.minijax.db.test.Widget in project minijax by minijax.
the class BaseEntityTest method testCopyPropertiesNull.
@Test(expected = NullPointerException.class)
public void testCopyPropertiesNull() {
final Widget w = new Widget();
w.copyNonNullProperties(null);
}
use of org.minijax.db.test.Widget in project minijax by minijax.
the class BaseEntityTest method testToJson.
@Test
public void testToJson() throws IOException {
final Widget w = new Widget();
w.setId(UUID.fromString("00000000-0000-0000-0000-000000000000"));
w.setCreatedDateTime(ZonedDateTime.of(2017, 10, 30, 4, 38, 0, 0, ZoneId.of("America/Los_Angeles")).toInstant());
w.setName("foo");
assertEquals("{\"id\":\"00000000-0000-0000-0000-000000000000\",\"createdDateTime\":\"2017-10-30T11:38:00Z\",\"name\":\"foo\"}", w.toJson());
}
Aggregations