Class MapMatchers

java.lang.Object
com.atlassian.jira.matchers.MapMatchers

public final class MapMatchers extends Object
Matchers for Maps.
Since:
v5.2
  • Method Details

    • isSingletonMap

      public static <K, V> org.hamcrest.Matcher<Map<K,V>> isSingletonMap(K expectedKey, V expectedValue)
    • hasKeyThat

      public static <K> org.hamcrest.Matcher<Map<? extends K,?>> hasKeyThat(org.hamcrest.Matcher<K> keyMatcher)
    • orderedMap

      public static <K, V> MapMatchers.OrderedMapMatcher<K,V> orderedMap(SortedMap<K,V> map)
      Matcher that checks that the elements of a Map are in a particular order.
      Type Parameters:
      K - the type of the keys.
      V - the type of the values.
      Parameters:
      map - the map the match against.
      Returns:
      a matcher that checks that the elements of a Map are in a particular order.
    • orderedMap

      public static <K, V> MapMatchers.OrderedMapMatcher<K,V> orderedMap(K key1, V value1)
      Matcher that checks that the elements of a Map are in a particular order.
      Type Parameters:
      K - the type of the keys.
      V - the type of the values.
      Parameters:
      key1 - the value of the first key.
      value1 - the value of the second key.
      Returns:
      a matcher that checks that the elements of a Map are in a particular order.
    • orderedMap

      public static <K, V> MapMatchers.OrderedMapMatcher<K,V> orderedMap(K key1, V value1, K key2, V value2)
      Matcher that checks that the elements of a Map are in a particular order.
      Type Parameters:
      K - the type of the keys.
      V - the type of the values.
      Parameters:
      key1 - the value of the first key.
      value1 - the value of the first value.
      key2 - the value of the second key.
      value2 - the value of the second value.
      Returns:
      a matcher that checks that the elements of a Map are in a particular order.
    • orderedMap

      public static <K, V> MapMatchers.OrderedMapMatcher<K,V> orderedMap(K key1, V value1, K key2, V value2, K key3, V value3)
      Matcher that checks that the elements of a Map are in a particular order.
      Type Parameters:
      K - the type of the keys.
      V - the type of the values.
      Parameters:
      key1 - the value of the first key.
      value1 - the value of the first value.
      key2 - the value of the second key.
      value2 - the value of the second value.
      key3 - the value of the third key.
      value3 - the value of the third value.
      Returns:
      a matcher that checks that the elements of a Map are in a particular order.
    • isMapOf

      public static <K, V> org.hamcrest.Matcher<Map<K,V>> isMapOf(K key1, V value1, K key2, V value2)
      Guava factory style map matcher for a map containing exactly 2 entries matching the arguments.
      Type Parameters:
      K - key type
      V - value type
      Parameters:
      key1 - key of the first entry
      value1 - value of the first entry
      key2 - key of the second entry
      value2 - key of the second entry
      Returns:
      matcher for the map equal to a map of provided keys and values
    • hasEntries

      public static <K, V> org.hamcrest.Matcher<Map<K,V>> hasEntries(Map<K,V> expectedMap)
    • isEmptyMap

      public static <K, V> org.hamcrest.Matcher<Map<K,V>> isEmptyMap()
    • isMapWithSize

      public static <K, V> org.hamcrest.Matcher<Map<K,V>> isMapWithSize(int size)