Interface CMapState<K,​V>

  • All Superinterfaces:
    CBaseState<java.util.Map<K,​V>>, CObjectState<java.util.Map<K,​V>>, java.io.Serializable
    All Known Subinterfaces:
    CMap<K,​V>, CMapExtension<K,​V>
    All Known Implementing Classes:
    CHashMap, CLinkedMap, CTestData

    public interface CMapState<K,​V>
    extends CObjectState<java.util.Map<K,​V>>

    CMapState is an interface for Map state related methods.

    We need this interface to have possibility of adding state to any exists objects with the minimum change in the code.

    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default boolean contains​(java.util.Map.Entry<K,​V> expected)
      Check if actual map contains the expected key and value.
      default boolean contains​(K expectedKey, V expectedValue)
      Check if actual map contains the expected key and value.
      default boolean containsAll​(java.util.Map<K,​V> expected)
      Check if actual map contains all entries from the expected map.
      default boolean containsAll​(java.util.Map<K,​V> expected, java.util.function.Consumer<java.util.Map.Entry<K,​V>> onNotMatch)
      Check if actual map contains all entries from the expected map.
      default boolean containsNone​(java.util.Map<K,​V> expected)
      Check if actual map contains none of entries from the expected map.
      default boolean containsNone​(java.util.Map<K,​V> expected, java.util.function.Consumer<java.util.Map.Entry<K,​V>> onMatch)
      Check if actual map contains none of entries from the expected map.
      default boolean emptyOrContains​(java.util.Map.Entry<K,​V> expected)
      Check if actual map either is empty or contains the expected entry.
      default boolean emptyOrContains​(K expectedKey, V expectedValue)
      Check if actual map either is empty or contains the expected entry.
      default boolean emptyOrNotContains​(java.util.Map.Entry<K,​V> expected)
      Check if actual map either is empty or does not contains the expected entry.
      default boolean emptyOrNotContains​(K expectedKey, V expectedValue)
      Check if actual map either is empty or does not contains the expected entry.
      default boolean isEqual​(java.util.Map<K,​V> expected)
      Check if actual and expected are equal
      default boolean isEqual​(java.util.Map<K,​V> expected, java.util.function.Consumer<java.util.Map.Entry<K,​V>> onActualNotContains, java.util.function.Consumer<java.util.Map.Entry<K,​V>> onExpectedNotContains)
      Check if actual and expected maps have the exact same entries.
      default boolean isNotEmpty()
      Check if that actual map is not empty.
      default boolean notContains​(java.util.Map.Entry<K,​V> expected)
      Check if actual map does not contain the expected entry.
      default boolean notContains​(K expectedKey, V expectedValue)
      Check if actual map does not contain the expected entry.
      default boolean notContainsAll​(java.util.Map<K,​V> expected)
      Check if actual map might contains some but not all entries from the expected map.
      default boolean sizeEquals​(int expected)
      Check if the map size is equal to expected value.
      default boolean sizeIsGreaterThan​(int expected)
      Check if that actual has value greater than expected.
      default boolean sizeIsGreaterThanOrEqual​(int expected)
      Check if that actual has value greater than or equal to expected.
      default boolean sizeIsLessThan​(int expected)
      Check if that actual has value less than expected.
      default boolean sizeIsLessThanOrEqual​(int expected)
      Check if that actual has value less than or equal to expected.
    • Method Detail

      • contains

        default boolean contains​(K expectedKey,
                                 V expectedValue)
        Check if actual map contains the expected key and value.
        Parameters:
        expectedKey - key to compare
        expectedValue - value to compare
        Returns:
        execution boolean result
      • contains

        default boolean contains​(java.util.Map.Entry<K,​V> expected)
        Check if actual map contains the expected key and value.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • containsAll

        default boolean containsAll​(java.util.Map<K,​V> expected)
        Check if actual map contains all entries from the expected map. Please note that actual map might have more entries.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • containsAll

        default boolean containsAll​(java.util.Map<K,​V> expected,
                                    java.util.function.Consumer<java.util.Map.Entry<K,​V>> onNotMatch)
        Check if actual map contains all entries from the expected map. Please note that actual map might have more entries.
        Parameters:
        expected - value to compare
        onNotMatch - consumer to call if miss match found
        Returns:
        execution boolean result
      • containsNone

        default boolean containsNone​(java.util.Map<K,​V> expected)
        Check if actual map contains none of entries from the expected map.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • containsNone

        default boolean containsNone​(java.util.Map<K,​V> expected,
                                     java.util.function.Consumer<java.util.Map.Entry<K,​V>> onMatch)
        Check if actual map contains none of entries from the expected map.
        Parameters:
        expected - value to compare
        onMatch - consumer to call if match found
        Returns:
        execution boolean result
      • emptyOrContains

        default boolean emptyOrContains​(K expectedKey,
                                        V expectedValue)
        Check if actual map either is empty or contains the expected entry.
        Parameters:
        expectedKey - key to compare
        expectedValue - value to compare
        Returns:
        execution boolean result
      • emptyOrContains

        default boolean emptyOrContains​(java.util.Map.Entry<K,​V> expected)
        Check if actual map either is empty or contains the expected entry.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • emptyOrNotContains

        default boolean emptyOrNotContains​(K expectedKey,
                                           V expectedValue)
        Check if actual map either is empty or does not contains the expected entry.
        Parameters:
        expectedKey - key to compare
        expectedValue - value to compare
        Returns:
        execution boolean result
      • emptyOrNotContains

        default boolean emptyOrNotContains​(java.util.Map.Entry<K,​V> expected)
        Check if actual map either is empty or does not contains the expected entry.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • isEqual

        default boolean isEqual​(java.util.Map<K,​V> expected)
        Description copied from interface: CObjectState
        Check if actual and expected are equal
        Specified by:
        isEqual in interface CObjectState<K>
        Parameters:
        expected - value to compare
        Returns:
        execution result
      • isEqual

        default boolean isEqual​(java.util.Map<K,​V> expected,
                                java.util.function.Consumer<java.util.Map.Entry<K,​V>> onActualNotContains,
                                java.util.function.Consumer<java.util.Map.Entry<K,​V>> onExpectedNotContains)
        Check if actual and expected maps have the exact same entries. (Ignore entry order) First we compare that actual map contains all expected map entries and then we verify that expected has all entries from actual.
        Parameters:
        expected - value to compare
        onActualNotContains - consumer to call if match found
        onExpectedNotContains - consumer to call if match found
        Returns:
        execution boolean result
      • isNotEmpty

        default boolean isNotEmpty()
        Check if that actual map is not empty. (might contains null values)
        Returns:
        execution boolean result
      • notContains

        default boolean notContains​(K expectedKey,
                                    V expectedValue)
        Check if actual map does not contain the expected entry.
        Parameters:
        expectedKey - key to compare
        expectedValue - value to compare
        Returns:
        execution boolean result
      • notContains

        default boolean notContains​(java.util.Map.Entry<K,​V> expected)
        Check if actual map does not contain the expected entry.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • notContainsAll

        default boolean notContainsAll​(java.util.Map<K,​V> expected)
        Check if actual map might contains some but not all entries from the expected map. Please note that actual map might have some of entries but the point is to ensure that not all expected entries are exist in it. We do verify that both key and value match in this comparision
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • sizeEquals

        default boolean sizeEquals​(int expected)
        Check if the map size is equal to expected value.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • sizeIsGreaterThan

        default boolean sizeIsGreaterThan​(int expected)
        Check if that actual has value greater than expected.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • sizeIsGreaterThanOrEqual

        default boolean sizeIsGreaterThanOrEqual​(int expected)
        Check if that actual has value greater than or equal to expected.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • sizeIsLessThan

        default boolean sizeIsLessThan​(int expected)
        Check if that actual has value less than expected.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • sizeIsLessThanOrEqual

        default boolean sizeIsLessThanOrEqual​(int expected)
        Check if that actual has value less than or equal to expected.
        Parameters:
        expected - value to compare
        Returns:
        execution boolean result