Class IterableDiff<T>

  • Type Parameters:
    T - the type of element to compare.

    class IterableDiff<T>
    extends java.lang.Object
    • Field Detail

      • unexpected

        java.util.List<T> unexpected
      • missing

        java.util.List<T> missing
    • Constructor Detail

      • IterableDiff

        IterableDiff​(java.lang.Iterable<T> actual,
                     java.lang.Iterable<T> expected,
                     ComparisonStrategy comparisonStrategy)
    • Method Detail

      • diff

        static <T> IterableDiff<T> diff​(java.lang.Iterable<T> actual,
                                        java.lang.Iterable<T> expected)
      • differencesFound

        boolean differencesFound()
      • unexpectedActualElements

        private java.util.List<T> unexpectedActualElements​(java.lang.Iterable<T> actual,
                                                           java.lang.Iterable<T> expected)
        Returns the list of elements in the first iterable that are not in the second, i.e. first - second
        Parameters:
        actual - the list we want to subtract from
        expected - the list to subtract
        Returns:
        the list of elements in the first iterable that are not in the second, i.e. first - second
      • isActualElementInExpected

        private boolean isActualElementInExpected​(T elementInActual,
                                                  java.util.List<T> copyOfExpected)
      • missingActualElements

        private java.util.List<T> missingActualElements​(java.lang.Iterable<T> actual,
                                                        java.lang.Iterable<T> expected)
      • iterableContains

        private boolean iterableContains​(java.lang.Iterable<?> actual,
                                         T expectedElement)
      • iterablesRemoveFirst

        private void iterablesRemoveFirst​(java.lang.Iterable<?> actual,
                                          T value)