ObjectTypeRetriever implements Function<Object, Class<?>> { @Override public Class<?> apply(@Nullable Object object) { if (object == null) { return NullType.class; } else if (object instanceof Class) { return (Class) object; } else { return object.getClass(); } }  @Override Class<?> apply(@Nullable Object object);  }
@Test public void passNullAndReturnAsNullAddress() { Class<?> result = new ObjectTypeRetriever().apply(null); assertTrue(result.equals(ObjectTypeRetriever.NullType.class)); }
@Test public void passObjectAndReturnAsClass() { Class<?> result = new ObjectTypeRetriever().apply(new A()); assertTrue(result.equals(A.class)); }
@Test public void passClassAndReturnAsClass() { Class<?> result = new ObjectTypeRetriever().apply(A.class); assertTrue(result.equals(A.class)); }