Package org.jtester.hamcrest.matcher.property.reflection

Examples of org.jtester.hamcrest.matcher.property.reflection.ReflectionComparator


    Set<String> keys = this.getAllKeys();

    List<Map<String, ?>> actuals = getObjectArrayFromList(list, keys, false);
    List<Map<String, ?>> expecteds = getObjectArrayFromList(this.expected, keys, true);

    ReflectionComparator reflectionComparator = createRefectionComparator(modes);
    this.difference = reflectionComparator.getDifference(expecteds, actuals);
    return difference == null;
  }
View Full Code Here


  }

  private Difference difference;

  public boolean matches(Object actual) {
    ReflectionComparator reflectionComparator = createRefectionComparator(modes);
    this.difference = reflectionComparator.getDifference(expected, actual);
    return difference == null;
  }
View Full Code Here

    List expected = ListHelper.toList(this.expected);
    if (ArrayHelper.isCollOrArray(this.expected)) {
      expected = PropertyAccessor.getPropertyOfList(expected, property, false);
    }

    ReflectionComparator reflectionComparator = createRefectionComparator(modes);
    this.difference = reflectionComparator.getDifference(expected, actuals);

    return difference == null;
  }
View Full Code Here

    Object actuals = PropertyAccessor.getPropertyByOgnl(pojo, property, true);
    Object expects = this.expected;
    if (ArrayHelper.isCollOrArray(this.expected) == false) {
      expects = PropertyAccessor.getPropertyByOgnl(this.expected, property, false);
    }
    ReflectionComparator reflectionComparator = createRefectionComparator(modes);
    this.difference = reflectionComparator.getDifference(expects, actuals);

    return difference == null;
  }
View Full Code Here

        Map<?, ?> rightMap = (Map<?, ?>) right;

        // Create copy from which we can remove elements.
        Map<Object, Object> rightCopy = new HashMap<Object, Object>(rightMap);

        ReflectionComparator keyReflectionComparator = createRefectionComparator();
        MapDifference difference = new MapDifference("Different elements", left, right, leftMap, rightMap);

        for (Map.Entry<?, ?> leftEntry : leftMap.entrySet()) {
            Object leftKey = leftEntry.getKey();
            Object leftValue = leftEntry.getValue();

            boolean found = false;
            Iterator<Map.Entry<Object, Object>> rightIterator = rightCopy.entrySet().iterator();
            while (rightIterator.hasNext()) {
                Map.Entry<Object, Object> rightEntry = rightIterator.next();
                Object rightKey = rightEntry.getKey();
                Object rightValue = rightEntry.getValue();

                // compare keys using strict reflection compare
                boolean isKeyEqual = keyReflectionComparator.isEqual(leftKey, rightKey);
                if (isKeyEqual) {
                    found = true;
                    rightIterator.remove();

                    // compare values
View Full Code Here

      buff.append("the size of expected array is greater then the size of actual array.");
    }
    List<List> actuals = PropertyAccessor.getPropertiesOfList(array, properties, true);
    List<List> expects = PropertyAccessor.getPropertiesOfList(expected, properties, false);

    ReflectionComparator reflectionComparator = createRefectionComparator(modes);
    this.difference = reflectionComparator.getDifference(expects, actuals);

    return difference == null;
  }
View Full Code Here

    if (ArrayHelper.isCollOrArray(this.expected)) {
      expects = ListHelper.toList(this.expected);
    } else {
      expects = PropertyAccessor.getPropertiesOfPoJo(this.expected, properties, false);
    }
    ReflectionComparator reflectionComparator = createRefectionComparator(modes);
    this.difference = reflectionComparator.getDifference(expects, actuals);

    return difference == null;
  }
View Full Code Here

        actuals.add(map);
        expecteds.add(this.expected);
      }
    }

    ReflectionComparator reflectionComparator = createRefectionComparator(modes);
    this.difference = reflectionComparator.getDifference(expecteds, actuals);
    return difference == null;
  }
View Full Code Here

TOP

Related Classes of org.jtester.hamcrest.matcher.property.reflection.ReflectionComparator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.