@Test public void test_equals() { assertThat(ref.equals(ref), equalTo(true)); assertThat(ref.equals(new TypeReference<String>() {}), equalTo(true)); assertThat(ref.equals(null), equalTo(false)); assertThat(ref.equals(""), equalTo(false)); assertThat(ref.equals(new TypeReference<Boolean>() {}), equalTo(false)); }
@Test public void testPrimitiveTypeFabricType() throws Exception { ReferenceSupplier<?> tr = TypeReference.referenceFabric( SimpleClass.class.getDeclaredField("simpleString").getGenericType()); assertEquals(tr.getType(), String.class); }
@Test public void testParametrizedTypeFabricType() throws Exception { ReferenceSupplier<?> tr = TypeReference.referenceFabric( SimpleClass.class.getDeclaredField("genericField").getGenericType()); assertEquals(((ParameterizedType) tr.getType()).getActualTypeArguments()[0], String.class); assertEquals(((ParameterizedType) tr.getType()).getRawType(), List.class); }
@Test public void testSimpleObjectFabricClass() throws Exception { ReferenceSupplier<SimpleClass> tr = TypeReference.referenceFabric(SimpleClass.class); assertEquals(tr.getType(), SimpleClass.class); }
@Test public void testSimpleTypeFabricClass() throws Exception { ReferenceSupplier<String> tr = TypeReference.referenceFabric(String.class); assertEquals(tr.getType(), String.class); }
@Test public void test_toString() { assertThat(ref.toString(), equalTo(String.class.toString())); }
@Test public void test_hashCode() { assertThat(ref.hashCode(), equalTo(String.class.hashCode())); }
@Test public void test_compareTo() { assertThat(ref.compareTo(null), equalTo(0)); }
@Test public void test_getType() { assertThat(ref.getType(), equalTo(String.class)); }