### Question:
TypeLiteral { public static <T> TypeLiteral<T> of(Class<T> type) { return new TypeLiteral<>(type); } @SuppressWarnings("unchecked") protected  TypeLiteral(); @SuppressWarnings("unchecked") private  TypeLiteral(Type type); private  TypeLiteral(Class<? super T> type, String... argumentTypes); private  TypeLiteral(Class<? super T> type, Type... argumentsType); static TypeLiteral<T> of(Class<T> type); static TypeLiteral<T> of(Type type); static TypeLiteral<T> of(Class<T> rawType, Type... parameters); static TypeLiteral<List<T>> listOf(Class<? extends T> type); static TypeLiteral<List<T>> listOf(TypeLiteral<? extends T> type); static TypeLiteral<Set<T>> setOf(Class<? extends T> valueType); static TypeLiteral<Set<T>> setOf(TypeLiteral<? extends T> valueType); static TypeLiteral<Map<K, V>> mapOf(Class<? extends K> keyType, Class<? extends V> valueType); static TypeLiteral<Map<K, V>> mapOf(TypeLiteral<? extends K> keyType, TypeLiteral<? extends V> valueType); static TypeLiteral<Optional<T>> optionalOf(Class<? extends T> type); static TypeLiteral<Optional<T>> optionalOf(TypeLiteral<? extends T> type); Class<? super T> getRawType(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testBaseEqualsInvariants() { TypeLiteral<Integer> typeLiteral1 = TypeLiteral.of(Integer.TYPE); TypeLiteral<Integer> typeLiteral2 = typeLiteral1; Object object = new Object(); assertEquals(typeLiteral1, typeLiteral2); Assert.assertNotEquals(typeLiteral1, object); }
@Test public void testEqualArrays() { TypeLiteral<int[]> typeLiteral1 = new TypeLiteral<int[]>(){}; TypeLiteral<int[]> typeLiteral2 = TypeLiteral.of(int[].class); TypeLiteral<Integer[]> typeLiteral3 = new TypeLiteral<Integer[]>(){}; TypeLiteral<Integer[]> typeLiteral4 = TypeLiteral.of(Integer[].class); assertEquals(typeLiteral1, typeLiteral2); assertEquals(typeLiteral3, typeLiteral4); assertNotEquals(typeLiteral1, typeLiteral3); assertNotEquals(typeLiteral2, typeLiteral4); }
@Test(expected = NullPointerException.class) public void testCreationFailure_NoType() { TypeLiteral.of(null); }