private String compareAndAssert(
      Object object1,
      Object object2,
      boolean expected,
      ArrayList<Field> fieldsToIgnore,
      StringFieldMatcher stringFieldMatcherToIgnore)
      throws IllegalArgumentException, IllegalAccessException {
    int maxDepth = Integer.MAX_VALUE;
    int maxSize = Integer.MAX_VALUE;

    RecursiveObjectComparer comparer = new RecursiveObjectComparer(maxDepth, maxSize);

    // Fields we are ok with being different:
    if (fieldsToIgnore != null) {
      comparer.addFieldsToIgnore(fieldsToIgnore);
    }
    if (stringFieldMatcherToIgnore != null) {
      comparer.addStringFieldsToIgnore(stringFieldMatcherToIgnore);
    }

    boolean result = comparer.compare(object1, object2);
    if (expected != result) {
      System.out.println("Differences:");
      System.out.println(comparer.toString());
    }
    assertEquals(expected, result);

    return comparer.toString();
  }
  @DeployableTestMethod(estimatedDuration = 0.0)
  @Test(timeout = 30000)
  public void testClearNotEqualInitially() throws IllegalArgumentException, IllegalAccessException {
    double[] array1 = new double[1];
    array1[0] = 1.0;
    double[] array2 = new double[1];
    array2[0] = 2.0;

    int maxDepth = Integer.MAX_VALUE;
    int maxSize = Integer.MAX_VALUE;
    RecursiveObjectComparer comparer = new RecursiveObjectComparer(maxDepth, maxSize);
    assertEquals(false, comparer.compare(array1, array2));

    comparer.clear();
    array2[0] = array1[0];
    assertEquals(true, comparer.compare(array1, array2));
  }