- // uncomment next line to see which fields hashCode ignores
- // System.out.println("hashCode ignores " + field.getName());
+ field.setAccessible(true);
+ Object oldValue = field.get(vs2);
+ changeValue(vs2, field);
+ assertFalse("equals method ignores " + field.getName(),
+ vs1.equals(vs2));
+
+ if (vs1.hashCode() == vs2.hashCode())
+ {
+ // uncomment next line to see which fields hashCode ignores
+ // System.out.println("hashCode ignores " + field.getName());
+ }
+ // restore original value before testing the next field
+ field.set(vs2, oldValue);