public Difference compare(Object left, Object right, boolean onlyFirstDifference,
ReflectionComparator reflectionComparator) {
// check different class type
Class clazz = left.getClass();
if (!clazz.isAssignableFrom(right.getClass())) {
return new ClassDifference("Different classes. Left: " + clazz + ", right: " + right.getClass(), left,
right, left.getClass(), right.getClass());
}
// compare all fields of the object using reflection
ObjectDifference difference = new ObjectDifference("Different field values", left, right);
compareFields(left, right, clazz, difference, onlyFirstDifference, reflectionComparator);