java.lang.Object
com.qaitsolutions.pframe.core.assertion.subjects.Subject
com.qaitsolutions.pframe.core.assertion.subjects.MapSubject

public final class MapSubject extends Subject
Wrapper over MapSubject

Since:
1.0
Author:
Iulian Andrei (iulian.andrei@qaitsolutions.com)
  • Constructor Details

    • MapSubject

      public MapSubject(Map<?,?> actual, String message)
      Constructor for regular assertions.

      Parameters:
      actual - Current value to be verified.
      message - Description of the assertion.
    • MapSubject

      public MapSubject(Map<?,?> actual, String message, ErrorTracker tracker)
      Constructor for soft assertions.

      Parameters:
      actual - Current value to be verified.
      message - Description of the assertion.
      tracker - Entity which allows keeping track of existing errors.
  • Method Details

    • isEqualTo

      public void isEqualTo(Object other)
      Description copied from class: Subject
      Fails if the subject is not equal to the given object. Wrapper over Subject.isEqualTo(Object).

      Overrides:
      isEqualTo in class Subject
      Parameters:
      other - Value to be checked against.
    • isEmpty

      public void isEmpty()
      Fails if the map is not empty. Wrapper over MapSubject.isEmpty().
    • isNotEmpty

      public void isNotEmpty()
      Fails if the map is empty. Wrapper over MapSubject.isNotEmpty().
    • hasSize

      public void hasSize(int expectedSize)
      Fails if the map does not have the given size. Wrapper over MapSubject.hasSize(int).

      Parameters:
      expectedSize - Value to be verified against.
    • containsKey

      public void containsKey(Object key)
      Fails if the map does not contain the given key. Wrapper over MapSubject.containsKey(Object).

      Parameters:
      key - Value to be verified against.
    • doesNotContainKey

      public void doesNotContainKey(Object key)
      Fails if the map contains the given key. Wrapper over MapSubject.doesNotContainKey(Object).

      Parameters:
      key - Value to be verified against.
    • containsEntry

      public void containsEntry(Object key, Object value)
      Fails if the map does not contain the given entry. Wrapper over MapSubject.containsEntry(Object, Object).

      Parameters:
      key - Value to be verified against.
      value - Value to be verified against.
    • doesNotContainEntry

      public void doesNotContainEntry(Object key, Object value)
      Fails if the map contains the given entry. Wrapper over MapSubject.doesNotContainEntry(Object, Object).

      Parameters:
      key - Value to be verified against.
      value - Value to be verified against.
    • containsExactly

      public void containsExactly(Object k0, Object v0, Object... rest)
      Fails if the map does not contain exactly the given set of key/value pairs. Wrapper over MapSubject.containsExactly(Object, Object, Object...).

      Parameters:
      k0 - Value to be verified against.
      v0 - Value to be verified against.
      rest - Value to be verified against.
    • containsAtLeast

      public void containsAtLeast(Object k0, Object v0, Object... rest)
      Fails if the map does not contain at least the given set of entries in the given map. Wrapper over MapSubject.containsAtLeast(Object, Object, Object...).

      Parameters:
      k0 - Value to be verified against.
      v0 - Value to be verified against.
      rest - Value to be verified against.
    • containsExactlyEntriesIn

      public void containsExactlyEntriesIn(Map<?,?> expectedMap)
      Fails if the map does not contain exactly the given set of entries in the given map. Wrapper over MapSubject.containsExactlyEntriesIn(Map).

      Parameters:
      expectedMap - Value to be verified against.
    • containsAtLeastEntriesIn

      public void containsAtLeastEntriesIn(Map<?,?> expectedMap)
      Fails if the map does not contain at least the given set of entries in the given map. Wrapper over MapSubject.containsAtLeastEntriesIn(Map).

      Parameters:
      expectedMap - Value to be verified against.