Package org.assertj.guava.api
Class RangeMapAssert<K extends Comparable<K>,V>
java.lang.Object
org.assertj.core.api.AbstractAssert<RangeMapAssert<K,V>,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:
Assert<RangeMapAssert<K,,V>, RangeMap<K, V>> Descriptable<RangeMapAssert<K,,V>> ExtensionPoints<RangeMapAssert<K,V>, RangeMap<K, V>>
public class RangeMapAssert<K extends Comparable<K>,V>
extends AbstractAssert<RangeMapAssert<K,V>,RangeMap<K,V>>
Assertions for guava
RangeMap.
To create an instance of this class, invoke Assertions.assertThat(com.google.common.collect.RangeMap)
- Author:
- Marcin KwaczyĆski
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal RangeMapAssert<K,V> Verifies that the actualRangeMapcontains the given entries.final RangeMapAssert<K,V> Deprecated.containsKeys(K... keys) Verifies that the actualRangeMapcontains the given keys.containsValues(V... values) Verifies that the actualRangeMapcontains the given values.isEmpty()Verifies that the actualRangeMapis empty.Verifies that the actualRangeMapis not empty.Methods inherited from class org.assertj.core.api.AbstractAssert
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs
-
Constructor Details
-
RangeMapAssert
-
-
Method Details
-
getActual
-
containsKeys
Verifies that the actualRangeMapcontains 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);keysargument is null or empty, anIllegalArgumentExceptionis thrown.- Parameters:
keys- the keys to look for in actualRangeMap.- Returns:
- this
RangeMapAssertfor assertions chaining. - Throws:
IllegalArgumentException- if no param keys have been set.AssertionError- if the actualRangeMapisnull.AssertionError- if the actualRangeMapdoes not contain the given keys.
-
contains
Deprecated.usecontains(MapEntry...)instead (same method but usingorg.assertj.core.data.MapEntryin place ofMapEntry.Verifies that the actual
RangeMapcontains 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 fromMapEntryassertThat(spectralColors).contains(entry("400", "violet"), entry("650", "red"));entriesargument is null or empty, anIllegalArgumentExceptionis thrown.- Parameters:
entries- the entries to look for in actualRangeMap.- Returns:
- this
RangeMapAssertfor assertions chaining. - Throws:
IllegalArgumentException- if no param entries have been set.AssertionError- if the actualRangeMapisnull.AssertionError- if the actualRangeMapdoes not contain the given entries.
-
contains
Verifies that the actualRangeMapcontains 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 fromMapEntryassertThat(spectralColors).contains(entry("400", "violet"), entry("650", "red"));entriesargument is null or empty, anIllegalArgumentExceptionis thrown.- Parameters:
entries- the entries to look for in actualRangeMap.- Returns:
- this
RangeMapAssertfor assertions chaining. - Throws:
IllegalArgumentException- if no param entries have been set.AssertionError- if the actualRangeMapisnull.AssertionError- if the actualRangeMapdoes not contain the given entries.
-
containsValues
Verifies that the actualRangeMapcontains 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");valuesargument is null or empty, anIllegalArgumentExceptionis thrown.- Parameters:
values- the values to look for in actualRangeMap.- Returns:
- this
RangeMapAssertfor assertions chaining. - Throws:
IllegalArgumentException- if no param values have been set.AssertionError- if the actualRangeMapisnull.AssertionError- if the actualRangeMapdoes not contain the given values.
-
isEmpty
Verifies that the actualRangeMapis empty.Example :
RangeMap<Integer, String> spectralColors = TreeRangeMap.create(); assertThat(actual).isEmpty();- Returns:
- this
RangeMapAssertfor assertions chaining. - Throws:
AssertionError- if the actualRangeMapisnull.AssertionError- if the actualRangeMapis not empty.
-
isNotEmpty
Verifies that the actualRangeMapis 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
RangeMapAssertfor assertions chaining. - Throws:
AssertionError- if the actualRangeMapisnull.AssertionError- if the actualRangeMapis empty.
-
contains(MapEntry...)instead (same method but usingorg.assertj.core.data.MapEntryin place ofMapEntry.