Class AssertContainsSameByIdentity

java.lang.Object
org.soliscode.test.assertions.collection.IterableAssertion
org.soliscode.test.assertions.collection.AssertContainsSameByIdentity

public final class AssertContainsSameByIdentity extends IterableAssertion
A collection of utility methods that support asserting that two collections contain the same elements by identity.
Since:
1.0.0
Author:
evanbergstromÒ
  • Method Details

    • assertContainsSameByIdentity

      public static void assertContainsSameByIdentity(Iterable<?> expected, Iterable<?> actual)
      Test if two iterables contain the same set of elements. Two elements are only considered the same is they have the same identity (i.e they are the same object).
      Parameters:
      expected - The iterable with the expected set of elements.
      actual - The iterable with the actual set of elements.
      Throws:
      org.opentest4j.AssertionFailedError - if the iterable does not contain all the elements.
    • assertContainsSameByIdentity

      public static void assertContainsSameByIdentity(Iterable<?> expected, Iterable<?> actual, String message)
      Test if two iterables contain the same set of elements. Two elements are only considered the same is they have the same identity (i.e they are the same object).
      Parameters:
      expected - The iterable with the expected set of elements.
      actual - The iterable with the actual set of elements.
      message - The message to supply if the assertion fails.
      Throws:
      org.opentest4j.AssertionFailedError - if the iterable does not contain all the elements.
    • assertContainsSameByIdentity

      public static void assertContainsSameByIdentity(Iterable<?> expected, Iterable<?> actual, Supplier<String> messageSupplier)
      Test if two iterables contain the same set of elements. Two elements are only considered the same is they have the same identity (i.e they are the same object).
      Parameters:
      expected - The iterable with the expected set of elements.
      actual - The iterable with the actual set of elements.
      messageSupplier - The supplier to call top generate message to supply if the assertion fails.
      Throws:
      org.opentest4j.AssertionFailedError - if the iterable does not contain all the elements.