K
- the type of keys of the tested RangeMap valueV
- the type of values of the tested RangeMap valuepublic class RangeMapAssert<K extends Comparable<K>,V> extends org.assertj.core.api.AbstractAssert<RangeMapAssert<K,V>,com.google.common.collect.RangeMap<K,V>>
RangeMap
.
To create an instance of this class, invoke Assertions.assertThat(com.google.common.collect.RangeMap)
Modifier | Constructor and Description |
---|---|
protected |
RangeMapAssert(com.google.common.collect.RangeMap<K,V> actual) |
Modifier and Type | Method and Description |
---|---|
RangeMapAssert<K,V> |
contains(MapEntry<K,V>... entries)
Verifies that the actual
RangeMap contains the given entries. |
RangeMapAssert<K,V> |
containsKeys(K... keys)
Verifies that the actual
RangeMap contains the given keys. |
RangeMapAssert<K,V> |
containsValues(V... values)
Verifies that the actual
RangeMap contains the given values. |
protected com.google.common.collect.RangeMap<K,V> |
getActual() |
RangeMapAssert<K,V> |
isEmpty()
Verifies that the actual
RangeMap is empty. |
RangeMapAssert<K,V> |
isNotEmpty()
Verifies that the actual
RangeMap is not empty. |
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, usingComparator, usingDefaultComparator, withThreadDumpOnError
public RangeMapAssert<K,V> containsKeys(K... keys)
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.
keys
- the keys to look for in actual RangeMap
.RangeMapAssert
for assertions chaining.IllegalArgumentException
- if no param keys have been set.AssertionError
- if the actual RangeMap
is null
.AssertionError
- if the actual RangeMap
does not contain the given keys.@SafeVarargs public final RangeMapAssert<K,V> contains(MapEntry<K,V>... entries)
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.
entries
- the entries to look for in actual RangeMap
.RangeMapAssert
for assertions chaining.IllegalArgumentException
- if no param entries have been set.AssertionError
- if the actual RangeMap
is null
.AssertionError
- if the actual RangeMap
does not contain the given entries.public RangeMapAssert<K,V> containsValues(V... values)
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.
values
- the values to look for in actual RangeMap
.RangeMapAssert
for assertions chaining.IllegalArgumentException
- if no param values have been set.AssertionError
- if the actual RangeMap
is null
.AssertionError
- if the actual RangeMap
does not contain the given values.public RangeMapAssert<K,V> isEmpty()
RangeMap
is empty.
Example :
RangeMap<Integer, String> spectralColors = TreeRangeMap.create();
assertThat(actual).isEmpty();
AssertionError
- if the actual RangeMap
is null
.AssertionError
- if the actual RangeMap
is not empty.public RangeMapAssert<K,V> isNotEmpty()
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();
AssertionError
- if the actual RangeMap
is null
.AssertionError
- if the actual RangeMap
is empty.Copyright © 2015 AssertJ. All rights reserved.