Search in sources :

Example 1 with UUIDUnspecifiedTypeGetter

use of org.simpleflatmapper.reflect.getter.UUIDUnspecifiedTypeGetter in project SimpleFlatMapper by arnaudroger.

the class UUIDUnspecifiedTypeGetterTest method test.

@Test
public void test() throws Exception {
    UUID uuid = UUID.randomUUID();
    @SuppressWarnings("unchecked") Getter<Object, Object> subGetter = mock(Getter.class);
    UUIDUnspecifiedTypeGetter<Object> getter = new UUIDUnspecifiedTypeGetter<Object>(subGetter);
    when(subGetter.get(any())).thenReturn(uuid.toString(), UUIDHelper.toBytes(uuid), new ByteArrayInputStream(UUIDHelper.toBytes(uuid)), new Date());
    assertEquals(uuid, getter.get(null));
    assertEquals(uuid, getter.get(null));
    assertEquals(uuid, getter.get(null));
    try {
        getter.get(null);
        fail();
    } catch (IllegalArgumentException e) {
    }
    getter.toString();
}
Also used : UUIDUnspecifiedTypeGetter(org.simpleflatmapper.reflect.getter.UUIDUnspecifiedTypeGetter) ByteArrayInputStream(java.io.ByteArrayInputStream) UUID(java.util.UUID) Date(java.util.Date) Test(org.junit.Test)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 Date (java.util.Date)1 UUID (java.util.UUID)1 Test (org.junit.Test)1 UUIDUnspecifiedTypeGetter (org.simpleflatmapper.reflect.getter.UUIDUnspecifiedTypeGetter)1