Package org.assertj.guava.api
Class RangeMapAssert<K extends Comparable<K>,V>
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<RangeMapAssert<K,V>,com.google.common.collect.RangeMap<K,V>>
-
- org.assertj.guava.api.RangeMapAssert<K,V>
-
- Type Parameters:
K
- the type of keys of the tested RangeMap valueV
- the type of values of the tested RangeMap value
- All Implemented Interfaces:
org.assertj.core.api.Assert<RangeMapAssert<K,V>,com.google.common.collect.RangeMap<K,V>>
,org.assertj.core.api.Descriptable<RangeMapAssert<K,V>>
,org.assertj.core.api.ExtensionPoints<RangeMapAssert<K,V>,com.google.common.collect.RangeMap<K,V>>
public class RangeMapAssert<K extends Comparable<K>,V> extends org.assertj.core.api.AbstractAssert<RangeMapAssert<K,V>,com.google.common.collect.RangeMap<K,V>>
Assertions for guavaRangeMap
.To create an instance of this class, invoke
Assertions.assertThat(com.google.common.collect.RangeMap)
- Author:
- Marcin KwaczyĆski
-
-
Field Summary
Fields Modifier and Type Field Description (package private) org.assertj.core.internal.Failures
failures
-
Constructor Summary
Constructors Modifier Constructor Description protected
RangeMapAssert(com.google.common.collect.RangeMap<K,V> actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RangeMapAssert<K,V>
contains(org.assertj.core.data.MapEntry<K,V>... entries)
Verifies that the actualRangeMap
contains the given entries.RangeMapAssert<K,V>
contains(MapEntry<K,V>... entries)
Deprecated.usecontains(MapEntry...)
instead (same method but usingorg.assertj.core.data.MapEntry
in place ofMapEntry
.RangeMapAssert<K,V>
containsKeys(K... keys)
Verifies that the actualRangeMap
contains the given keys.RangeMapAssert<K,V>
containsValues(V... values)
Verifies that the actualRangeMap
contains the given values.protected com.google.common.collect.RangeMap<K,V>
getActual()
RangeMapAssert<K,V>
isEmpty()
Verifies that the actualRangeMap
is empty.RangeMapAssert<K,V>
isNotEmpty()
Verifies that the actualRangeMap
is not empty.-
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asInstanceOf, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Method Detail
-
containsKeys
public RangeMapAssert<K,V> containsKeys(K... keys)
Verifies that the actualRangeMap
contains the given keys.
Example :
If theRangeMap<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);
keys
argument is null or empty, anIllegalArgumentException
is thrown.- Parameters:
keys
- the keys to look for in actualRangeMap
.- Returns:
- this
RangeMapAssert
for assertions chaining. - Throws:
IllegalArgumentException
- if no param keys have been set.AssertionError
- if the actualRangeMap
isnull
.AssertionError
- if the actualRangeMap
does not contain the given keys.
-
contains
@SafeVarargs @Deprecated public final RangeMapAssert<K,V> contains(MapEntry<K,V>... entries)
Deprecated.usecontains(MapEntry...)
instead (same method but usingorg.assertj.core.data.MapEntry
in place ofMapEntry
.Verifies that the actual
RangeMap
contains the given entries.
Example :
If theRangeMap<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"));entries
argument is null or empty, anIllegalArgumentException
is thrown.- Parameters:
entries
- the entries to look for in actualRangeMap
.- Returns:
- this
RangeMapAssert
for assertions chaining. - Throws:
IllegalArgumentException
- if no param entries have been set.AssertionError
- if the actualRangeMap
isnull
.AssertionError
- if the actualRangeMap
does not contain the given entries.
-
contains
@SafeVarargs public final RangeMapAssert<K,V> contains(org.assertj.core.data.MapEntry<K,V>... entries)
Verifies that the actualRangeMap
contains the given entries.
Example :
If theRangeMap<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"));entries
argument is null or empty, anIllegalArgumentException
is thrown.- Parameters:
entries
- the entries to look for in actualRangeMap
.- Returns:
- this
RangeMapAssert
for assertions chaining. - Throws:
IllegalArgumentException
- if no param entries have been set.AssertionError
- if the actualRangeMap
isnull
.AssertionError
- if the actualRangeMap
does not contain the given entries.
-
containsValues
public RangeMapAssert<K,V> containsValues(V... values)
Verifies that the actualRangeMap
contains the given values.
Example :
If theRangeMap<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");
values
argument is null or empty, anIllegalArgumentException
is thrown.- Parameters:
values
- the values to look for in actualRangeMap
.- Returns:
- this
RangeMapAssert
for assertions chaining. - Throws:
IllegalArgumentException
- if no param values have been set.AssertionError
- if the actualRangeMap
isnull
.AssertionError
- if the actualRangeMap
does not contain the given values.
-
isEmpty
public RangeMapAssert<K,V> isEmpty()
Verifies that the actualRangeMap
is empty.Example :
RangeMap<Integer, String> spectralColors = TreeRangeMap.create(); assertThat(actual).isEmpty();
- Returns:
- this
RangeMapAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeMap
isnull
.AssertionError
- if the actualRangeMap
is not empty.
-
isNotEmpty
public RangeMapAssert<K,V> isNotEmpty()
Verifies that the actualRangeMap
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:
AssertionError
- if the actualRangeMap
isnull
.AssertionError
- if the actualRangeMap
is empty.
-
-