### Question:
DefaultTypeVariable implements TypeVariable<D> { @Override public boolean equals(Object object) { if (!(object instanceof TypeVariable)) { return false; } TypeVariable<?> typeVariable = (TypeVariable<?>) object; return declaration.equals(typeVariable.getGenericDeclaration()) && name.equals(typeVariable.getName()) && Arrays.equals(bounds, typeVariable.getBounds()); } DefaultTypeVariable(D declaration, String name, Type[] bounds); D getGenericDeclaration(); String getName(); Type[] getBounds(); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString(); static String toString(TypeVariable<?> type); static String toString(TypeVariable<?> type, ClassSerializer serializer);  }### Answer:
@Test public void equalsWithDifferentClass() { TypeVariable<Constructor<?>> typeVariable = new DefaultTypeVariable<Constructor<?>>(constructor, "T", null); assertFalse(typeVariable.equals(new Object())); }
@Test public void equalsWithDifferentDeclarations() throws NoSuchMethodException { TypeVariable<Constructor<?>> typeVariable1 = new DefaultTypeVariable<Constructor<?>>(constructor, "T", new Type[] {Number.class}); Method method = getClass().getDeclaredMethod("equalsWithDifferentDeclarations"); TypeVariable<Method> typeVariable2 = new DefaultTypeVariable<Method>(method, "T", new Type[] {Number.class}); assertFalse(typeVariable1.equals(typeVariable2)); }
@Test public void equalsWithDifferentNames() { TypeVariable<Constructor<?>> typeVariable1 = new DefaultTypeVariable<Constructor<?>>(constructor, "T", new Type[] {Number.class}); TypeVariable<Constructor<?>> typeVariable2 = new DefaultTypeVariable<Constructor<?>>(constructor, "U", new Type[] {Number.class}); assertFalse(typeVariable1.equals(typeVariable2)); }
@Test public void equalsWithDifferentBounds() { TypeVariable<Constructor<?>> typeVariable1 = new DefaultTypeVariable<Constructor<?>>(constructor, "T", new Type[] {Number.class}); TypeVariable<Constructor<?>> typeVariable2 = new DefaultTypeVariable<Constructor<?>>(constructor, "T", new Type[] {Integer.class}); assertFalse(typeVariable1.equals(typeVariable2)); }