Class RangeMapAssert<K extends java.lang.Comparable<K>,​V>

    • Constructor Detail

      • RangeMapAssert

        protected RangeMapAssert​(com.google.common.collect.RangeMap<K,​V> actual)
    • Method Detail

      • getActual

        protected com.google.common.collect.RangeMap<K,​V> getActual()
      • containsKeys

        public RangeMapAssert<K,​V> containsKeys​(K... keys)
        Verifies that the actual RangeMap contains the given keys.

        Example :

         RangeMap<Integer, String> spectralColors = TreeRangeMap.create();
        
         spectralColors.put(Range.closedOpen(380, 450), "violet");
         spectralColors.put(Range.closedOpen(450, 495), "blue");
         spectralColors.put(Range.closedOpen(495, 570), "green");
         spectralColors.put(Range.closedOpen(570, 590), "yellow");
         spectralColors.put(Range.closedOpen(590, 620), "orange");
         spectralColors.put(Range.closedOpen(620, 750), "red");
        
         assertThat(spectralColors).containsKeys(380, 600, 700);
        If the keys argument is null or empty, an IllegalArgumentException is thrown.

        Parameters:
        keys - the keys to look for in actual RangeMap.
        Returns:
        this RangeMapAssert for assertions chaining.
        Throws:
        java.lang.IllegalArgumentException - if no param keys have been set.
        java.lang.AssertionError - if the actual RangeMap is null.
        java.lang.AssertionError - if the actual RangeMap does not contain the given keys.
      • contains

        @SafeVarargs
        @Deprecated
        public final RangeMapAssert<K,​V> contains​(MapEntry<K,​V>... entries)
        Deprecated.
        use contains(MapEntry...) instead (same method but using org.assertj.core.data.MapEntry in place of MapEntry.

        Verifies that the actual RangeMap contains the given entries.

        Example :

         RangeMap<Integer, String> spectralColors = TreeRangeMap.create();
        
         spectralColors.put(Range.closedOpen(380, 450), "violet");
         spectralColors.put(Range.closedOpen(450, 495), "blue");
         spectralColors.put(Range.closedOpen(495, 570), "green");
         spectralColors.put(Range.closedOpen(570, 590), "yellow");
         spectralColors.put(Range.closedOpen(590, 620), "orange");
         spectralColors.put(Range.closedOpen(620, 750), "red");
        
         // entry can be statically imported from MapEntry
         assertThat(spectralColors).contains(entry("400", "violet"), entry("650", "red"));
        If the entries argument is null or empty, an IllegalArgumentException is thrown.

        Parameters:
        entries - the entries to look for in actual RangeMap.
        Returns:
        this RangeMapAssert for assertions chaining.
        Throws:
        java.lang.IllegalArgumentException - if no param entries have been set.
        java.lang.AssertionError - if the actual RangeMap is null.
        java.lang.AssertionError - if the actual RangeMap does not contain the given entries.
      • contains

        @SafeVarargs
        public final RangeMapAssert<K,​V> contains​(MapEntry<K,​V>... entries)
        Verifies that the actual RangeMap contains the given entries.

        Example :

         RangeMap<Integer, String> spectralColors = TreeRangeMap.create();
        
         spectralColors.put(Range.closedOpen(380, 450), "violet");
         spectralColors.put(Range.closedOpen(450, 495), "blue");
         spectralColors.put(Range.closedOpen(495, 570), "green");
         spectralColors.put(Range.closedOpen(570, 590), "yellow");
         spectralColors.put(Range.closedOpen(590, 620), "orange");
         spectralColors.put(Range.closedOpen(620, 750), "red");
        
         // entry can be statically imported from MapEntry
         assertThat(spectralColors).contains(entry("400", "violet"), entry("650", "red"));
        If the entries argument is null or empty, an IllegalArgumentException is thrown.

        Parameters:
        entries - the entries to look for in actual RangeMap.
        Returns:
        this RangeMapAssert for assertions chaining.
        Throws:
        java.lang.IllegalArgumentException - if no param entries have been set.
        java.lang.AssertionError - if the actual RangeMap is null.
        java.lang.AssertionError - if the actual RangeMap does not contain the given entries.
      • containsValues

        public RangeMapAssert<K,​V> containsValues​(V... values)
        Verifies that the actual RangeMap contains the given values.

        Example :

         RangeMap<Integer, String> spectralColors = TreeRangeMap.create();
        
         spectralColors.put(Range.closedOpen(380, 450), "violet");
         spectralColors.put(Range.closedOpen(450, 495), "blue");
         spectralColors.put(Range.closedOpen(495, 570), "green");
         spectralColors.put(Range.closedOpen(570, 590), "yellow");
         spectralColors.put(Range.closedOpen(590, 620), "orange");
         spectralColors.put(Range.closedOpen(620, 750), "red");
        
         assertThat(actual).containsValues("violet", "orange");
        If the values argument is null or empty, an IllegalArgumentException is thrown.

        Parameters:
        values - the values to look for in actual RangeMap.
        Returns:
        this RangeMapAssert for assertions chaining.
        Throws:
        java.lang.IllegalArgumentException - if no param values have been set.
        java.lang.AssertionError - if the actual RangeMap is null.
        java.lang.AssertionError - if the actual RangeMap does not contain the given values.
      • isEmpty

        public RangeMapAssert<K,​V> isEmpty()
        Verifies that the actual RangeMap is empty.

        Example :

         RangeMap<Integer, String> spectralColors = TreeRangeMap.create();
        
         assertThat(actual).isEmpty();
        Returns:
        this RangeMapAssert for assertions chaining.
        Throws:
        java.lang.AssertionError - if the actual RangeMap is null.
        java.lang.AssertionError - if the actual RangeMap is not empty.
      • isNotEmpty

        public RangeMapAssert<K,​V> isNotEmpty()
        Verifies that the actual RangeMap is not empty.

        Example :

         RangeMap<Integer, String> spectralColors = TreeRangeMap.create();
         spectralColors.put(Range.closedOpen(380, 450), "violet");
         spectralColors.put(Range.closedOpen(450, 495), "blue");
         spectralColors.put(Range.closedOpen(495, 570), "green");
         spectralColors.put(Range.closedOpen(570, 590), "yellow");
         spectralColors.put(Range.closedOpen(590, 620), "orange");
         spectralColors.put(Range.closedOpen(620, 750), "red");
        
         assertThat(spectralColors).isNotEmpty();
        Returns:
        this RangeMapAssert for assertions chaining.
        Throws:
        java.lang.AssertionError - if the actual RangeMap is null.
        java.lang.AssertionError - if the actual RangeMap is empty.