Package org.assertj.guava.api
Class RangeSetAssert<T extends Comparable<T>>
java.lang.Object
org.assertj.core.api.AbstractAssert<RangeSetAssert<T>,com.google.common.collect.RangeSet<T>>
org.assertj.guava.api.RangeSetAssert<T>
- Type Parameters:
T
- the type of the tested RangeSet elements
- All Implemented Interfaces:
Assert<RangeSetAssert<T>,
,com.google.common.collect.RangeSet<T>> Descriptable<RangeSetAssert<T>>
,ExtensionPoints<RangeSetAssert<T>,
com.google.common.collect.RangeSet<T>>
public class RangeSetAssert<T extends Comparable<T>>
extends AbstractAssert<RangeSetAssert<T>,com.google.common.collect.RangeSet<T>>
Assertion for guava
RangeSet
.
To create an instance of this class, invoke
.
Assertions.assertThat(RangeSet)
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
RangeSetAssert
(com.google.common.collect.RangeSet<T> actual) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
assertContains
(T[] values) private void
assertContainsAll
(Iterable<T> values) private void
assertContainsAnyOf
(T[] values) private void
assertContainsAnyRangesOf
(Iterable<T> values) private void
assertDoesNotContain
(T[] values) private void
assertDoesNotContainAll
(Iterable<T> values) private void
assertDoesNotEnclose
(com.google.common.collect.Range<T>[] ranges) private void
assertDoesNotEncloseAnyRangesOf
(com.google.common.collect.RangeSet<T> rangeSet) private void
assertDoesNotEncloseAnyRangesOf
(Iterable<com.google.common.collect.Range<T>> ranges) private void
assertDoesNotIntersect
(com.google.common.collect.Range<T>[] ranges) private void
assertDoesNotIntersectAnyRangeFrom
(com.google.common.collect.RangeSet<T> rangeSet) private void
assertDoesNotIntersectAnyRangeFrom
(Iterable<com.google.common.collect.Range<T>> ranges) private void
private void
assertEncloses
(com.google.common.collect.Range<T>[] ranges) private void
assertEnclosesAll
(com.google.common.collect.RangeSet<T> rangeSet) private void
assertEnclosesAll
(Iterable<com.google.common.collect.Range<T>> ranges) private void
assertEnclosesAnyOf
(com.google.common.collect.Range<T>[] ranges) private void
assertEnclosesAnyRangesOf
(com.google.common.collect.RangeSet<T> rangeSet) private void
assertEnclosesAnyRangesOf
(Iterable<com.google.common.collect.Range<T>> ranges) private void
assertHasSize
(int expectedSize) private void
assertIntersects
(com.google.common.collect.Range<T>[] ranges) private void
assertIntersectsAll
(com.google.common.collect.RangeSet<T> rangeSet) private void
assertIntersectsAll
(Iterable<com.google.common.collect.Range<T>> ranges) private void
assertIntersectsAnyOf
(com.google.common.collect.Range<T>[] ranges) private void
assertIntersectsAnyRangesOf
(com.google.common.collect.RangeSet<T> rangeSet) private void
assertIntersectsAnyRangesOf
(Iterable<com.google.common.collect.Range<T>> ranges) private void
private void
private void
assertRangeSetContainsAnyGivenValues
(com.google.common.collect.RangeSet actual, Comparable[] values) private void
assertRangeSetContainsGivenValues
(com.google.common.collect.RangeSet actual, Comparable[] values) private void
assertRangeSetDoesNotContainGivenValues
(com.google.common.collect.RangeSet actual, Comparable[] values) private void
assertRangeSetDoesNotEncloseGivenValues
(com.google.common.collect.Range<T>[] ranges) private void
assertRangeSetDoesNotIntersectGivenValues
(com.google.common.collect.Range<T>[] ranges) private void
assertRangeSetEnclosesAnyOfGivenValues
(com.google.common.collect.Range<T>[] ranges) private void
assertRangeSetEnclosesGivenValues
(com.google.common.collect.Range<T>[] ranges) private void
assertRangeSetIntersectsAnyOfGivenValues
(com.google.common.collect.Range<T>[] ranges) private void
assertRangeSetIntersectsGivenValues
(com.google.common.collect.Range<T>[] ranges) final RangeSetAssert
<T> Verifies that the givenRangeSet
contains the given values.containsAll
(Iterable<T> values) Verifies that the givenRangeSet
contains all the given values.final RangeSetAssert
<T> containsAnyOf
(T... values) Verifies that the givenRangeSet
contains at least one of the given values.containsAnyRangesOf
(Iterable<T> values) Verifies that the givenRangeSet
contains at least one of the given values.final RangeSetAssert
<T> doesNotContain
(T... values) Verifies that the givenRangeSet
does not contain any of the given values.doesNotContainAll
(Iterable<T> values) Verifies that the givenRangeSet
does not contain any of the given values.final RangeSetAssert
<T> doesNotEnclose
(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
does not enclose the given ranges.doesNotEncloseAnyRangesOf
(com.google.common.collect.RangeSet<T> rangeSet) Verifies that the givenRangeSet
does not enclose any range from the given range set.doesNotEncloseAnyRangesOf
(Iterable<com.google.common.collect.Range<T>> ranges) Verifies that the givenRangeSet
does not enclose any of the given ranges.final RangeSetAssert
<T> doesNotIntersect
(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
does not intersect the given ranges.doesNotIntersectAnyRangeFrom
(com.google.common.collect.RangeSet<T> rangeSet) Verifies that the givenRangeSet
does not intersect ranges from the given range set.doesNotIntersectAnyRangeFrom
(Iterable<com.google.common.collect.Range<T>> ranges) Verifies that the givenRangeSet
does not intersect all the given ranges.final RangeSetAssert
<T> Verifies that the givenRangeSet
encloses the given ranges.enclosesAll
(com.google.common.collect.RangeSet<T> rangeSet) Verifies that the givenRangeSet
encloses all ranges from the given range set.enclosesAll
(Iterable<com.google.common.collect.Range<T>> ranges) Verifies that the givenRangeSet
encloses all the given ranges.final RangeSetAssert
<T> enclosesAnyOf
(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
encloses at least one of the given ranges.enclosesAnyRangesOf
(com.google.common.collect.RangeSet<T> rangeSet) Verifies that the givenRangeSet
encloses at least one range from the given range set.enclosesAnyRangesOf
(Iterable<com.google.common.collect.Range<T>> ranges) Verifies that the givenRangeSet
encloses at least one range of the given ranges.private static <T> void
failIfEmpty
(com.google.common.collect.RangeSet<?> rangeSet) private static <T> void
failIfEmpty
(Iterable<T> iterable, String label) private static <T> void
failIfEmpty
(T[] array, String label) hasSize
(int size) Verifies that the givenRangeSet
has specificsize
of disconnectedRange
elements.final RangeSetAssert
<T> intersects
(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
intersects all the given ranges.intersectsAll
(com.google.common.collect.RangeSet<T> rangeSet) Verifies that the givenRangeSet
intersects all ranges from the given range set.intersectsAll
(Iterable<com.google.common.collect.Range<T>> ranges) Verifies that the givenRangeSet
intersects all the given ranges.final RangeSetAssert
<T> intersectsAnyOf
(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
intersects at least one of the given ranges.intersectsAnyRangesOf
(com.google.common.collect.RangeSet<T> rangeSet) Verifies that the givenRangeSet
intersects at least one range of the given range set.intersectsAnyRangesOf
(Iterable<com.google.common.collect.Range<T>> ranges) Verifies that the givenRangeSet
intersects at least one of the given ranges.isEmpty()
Verifies that the actualRangeSet
is empty.Verifies that the actualRangeSet
is not empty.Verifies that the actualRangeSet
isnull
or 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, withThreadDumpOnError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs
-
Constructor Details
-
RangeSetAssert
-
-
Method Details
-
hasSize
Verifies that the givenRangeSet
has specificsize
of disconnectedRange
elements.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).hasSize(3);
- Parameters:
size
- expected amount of disconnectedRange
elements.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actual size ofRangeSet
is different from the expectedsize
.
-
assertHasSize
private void assertHasSize(int expectedSize) -
contains
Verifies that the givenRangeSet
contains the given values.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).contains(50, 270, 550);
- Parameters:
values
- the values to look for in actualRangeSet
.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not contain the givenvalues
.NullPointerException
- if values are null.IllegalArgumentException
- if values are empty while actual is not empty.
-
assertContains
-
containsAll
Verifies that the givenRangeSet
contains all the given values.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).containsAll(Arrays.asList(50, 270, 550));
- Parameters:
values
- the values to look for in actualRangeSet
.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not contain all the givenvalues
.NullPointerException
- if values are null.IllegalArgumentException
- if values are empty while actual is not empty.
-
assertContainsAll
-
assertRangeSetContainsGivenValues
private void assertRangeSetContainsGivenValues(com.google.common.collect.RangeSet actual, Comparable[] values) -
containsAnyOf
Verifies that the givenRangeSet
contains at least one of the given values.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).containsAnyOf(150, 250, 700);
- Parameters:
values
- the values to look for in actualRangeSet
.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not contain at least one of the givenvalues
.NullPointerException
- if values are null.IllegalArgumentException
- if values are empty while actual is not empty.
-
assertContainsAnyOf
-
containsAnyRangesOf
Verifies that the givenRangeSet
contains at least one of the given values.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).containsAnyRangesOf(Arrays.asList(150, 250, 700));
- Parameters:
values
- the values to look for in actualRangeSet
.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not contain at least one of the givenvalues
.NullPointerException
- if values are null.IllegalArgumentException
- if values are empty while actual is not empty.
-
assertContainsAnyRangesOf
-
assertRangeSetContainsAnyGivenValues
private void assertRangeSetContainsAnyGivenValues(com.google.common.collect.RangeSet actual, Comparable[] values) -
doesNotContain
Verifies that the givenRangeSet
does not contain any of the given values.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).doesNotContain(150, 320, 650);
- Parameters:
values
- the values that should not be present in actualRangeSet
- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
contains any of the givenvalues
.NullPointerException
- if values are null.IllegalArgumentException
- if values are empty.
-
assertDoesNotContain
-
doesNotContainAll
Verifies that the givenRangeSet
does not contain any of the given values.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).doesNotContain(Arrays.asList(150, 320, 650));
- Parameters:
values
- the values that should not be present in actualRangeSet
- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
contains any of the givenvalues
.NullPointerException
- if values are null.IllegalArgumentException
- if values are empty.
-
assertDoesNotContainAll
-
assertRangeSetDoesNotContainGivenValues
private void assertRangeSetDoesNotContainGivenValues(com.google.common.collect.RangeSet actual, Comparable[] values) -
isEmpty
Verifies that the actualRangeSet
is empty.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); assertThat(rangeSet).isEmpty();
- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
is not empty.
-
assertEmpty
private void assertEmpty() -
isNotEmpty
Verifies that the actualRangeSet
is not empty.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).isNotEmpty();
- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
is empty.
-
assertNotEmpty
private void assertNotEmpty() -
isNullOrEmpty
Verifies that the actualRangeSet
isnull
or empty.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); assertThat(rangeSet).isNullOrEmpty();
- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
is notnull
or not empty.
-
assertNullOrEmpty
private void assertNullOrEmpty() -
intersects
@SafeVarargs public final RangeSetAssert<T> intersects(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
intersects all the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).intersects(Range.closed(50, 150), Range.openClosed(170, 220), Range.open(520, 570));
- Parameters:
ranges
- the ranges to check whether they intersect the givenRangeSet
.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not intersect all the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty while actual is not empty.
-
assertIntersects
-
intersectsAll
Verifies that the givenRangeSet
intersects all ranges from the given range set.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).intersectsAll(ImmutableRangeSet.of(Range.closed(50, 250)));
- Parameters:
rangeSet
- the range set to check whether it intersects the actualRangeSet
.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not intersect all the ranges from the given range set.NullPointerException
- if range set is null.IllegalArgumentException
- if range set is empty while actual is not empty.
-
assertIntersectsAll
-
intersectsAll
Verifies that the givenRangeSet
intersects all the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).intersectsAll(Arrays.asList(Range.closed(50, 150), Range.openClosed(170, 220), Range.open(520, 570)));
- Parameters:
ranges
- the ranges to check whether they all intersect the givenRangeSet
.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not intersect all the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty while actual is not empty.
-
assertIntersectsAll
-
assertRangeSetIntersectsGivenValues
-
intersectsAnyOf
@SafeVarargs public final RangeSetAssert<T> intersectsAnyOf(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
intersects at least one of the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).intersectsAnyOf(Range.closed(50, 150), Range.open(170, 190), Range.open(600, 670));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
intersects at least one of them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not intersect any of the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty while actual is not empty.
-
assertIntersectsAnyOf
-
intersectsAnyRangesOf
Verifies that the givenRangeSet
intersects at least one of the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).intersectsAnyRangesOf(Arrays.asList(Range.closed(50, 150), Range.open(170, 190), Range.open(600, 670));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
intersects at least one of them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not intersect any of the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty while actual is not empty.
-
assertIntersectsAnyRangesOf
-
intersectsAnyRangesOf
Verifies that the givenRangeSet
intersects at least one range of the given range set.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).intersectsAnyRangesOf(ImmutableRangeSet.of(Range.close(50, 150)));
- Parameters:
rangeSet
- the range set with ranges to check whether the actualRangeSet
intersects at least one of them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not intersect any of the ranges from the given ranges set.NullPointerException
- if range set is null.IllegalArgumentException
- if range set is empty while actual is not empty.
-
assertIntersectsAnyRangesOf
-
assertRangeSetIntersectsAnyOfGivenValues
-
doesNotIntersect
@SafeVarargs public final RangeSetAssert<T> doesNotIntersect(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
does not intersect the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).doesNotIntersect(Range.closed(120, 150), Range.open(302, 490), Range.open(600, 670));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
does not intersect them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
intersects the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty.
-
assertDoesNotIntersect
-
doesNotIntersectAnyRangeFrom
public RangeSetAssert<T> doesNotIntersectAnyRangeFrom(com.google.common.collect.RangeSet<T> rangeSet) Verifies that the givenRangeSet
does not intersect ranges from the given range set.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).doesNotIntersectAnyRangeFrom(ImmutableRangeSet.of(Range.close(120, 170)));
- Parameters:
rangeSet
- the range set to check whether the actualRangeSet
does not intersect ranges from it.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
intersects the ranges from the given range set.NullPointerException
- if range set is null.IllegalArgumentException
- if range set is empty.
-
assertDoesNotIntersectAnyRangeFrom
-
doesNotIntersectAnyRangeFrom
public RangeSetAssert<T> doesNotIntersectAnyRangeFrom(Iterable<com.google.common.collect.Range<T>> ranges) Verifies that the givenRangeSet
does not intersect all the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).doesNotIntersectAnyRangeFrom(Arrays.asList(Range.closed(120, 150), Range.open(302, 490), Range.open(600, 670));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
does not intersect them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
intersects all the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty.
-
assertDoesNotIntersectAnyRangeFrom
-
assertRangeSetDoesNotIntersectGivenValues
-
encloses
Verifies that the givenRangeSet
encloses the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).encloses(Range.closed(0, 10), Range.open(50, 60), Range.open(90, 100));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
encloses them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not enclose the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty while actual is not empty.
-
assertEncloses
-
enclosesAll
Verifies that the givenRangeSet
encloses all the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).enclosesAll(Arrays.asList(Range.closed(0, 10), Range.open(50, 60), Range.open(90, 100)));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
encloses all of them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not enclose all the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty while actual is not empty.
-
assertEnclosesAll
-
enclosesAll
Verifies that the givenRangeSet
encloses all ranges from the given range set.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).enclosesAll(ImmutableRangeSet.of(Range.closed(0, 50));
- Parameters:
rangeSet
- the range set to check whether the actualRangeSet
encloses all range from it.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not enclose all ranges from the given range set.NullPointerException
- if range set is null.IllegalArgumentException
- if range set is empty while actual is not empty.
-
assertEnclosesAll
-
assertRangeSetEnclosesGivenValues
-
enclosesAnyOf
@SafeVarargs public final RangeSetAssert<T> enclosesAnyOf(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
encloses at least one of the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).enclosesAnyOf(Range.closed(-10, 10), Range.open(150, 260), Range.open(290, 296));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
encloses at least one of them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not enclose at least one of the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty while actual is not empty.
-
assertEnclosesAnyOf
-
enclosesAnyRangesOf
Verifies that the givenRangeSet
encloses at least one range of the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).enclosesAnyRangesOf(Arrays.asList(Range.closed(-10, 10), Range.open(150, 260), Range.open(290, 296)));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
encloses at least one of them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not enclose at least one of the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty while actual is not empty.
-
assertEnclosesAnyRangesOf
-
enclosesAnyRangesOf
Verifies that the givenRangeSet
encloses at least one range from the given range set.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); RangeSet<Integer> enclosedSet = TreeRangeSet.create(); enclosedSet.add(Range.closed(-10, 10)); enclosedSet.add(Range.open(150, 260)); enclosedSet.add(Range.open(290, 296)); assertThat(rangeSet).enclosesAll(enclosedSet);
- Parameters:
rangeSet
- the range set to check whether the actualRangeSet
encloses at least one range from it.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
does not enclose at least one range from the given range set.NullPointerException
- if range set is null.IllegalArgumentException
- if range set is empty while actual is not empty.
-
assertEnclosesAnyRangesOf
-
assertRangeSetEnclosesAnyOfGivenValues
-
doesNotEnclose
@SafeVarargs public final RangeSetAssert<T> doesNotEnclose(com.google.common.collect.Range<T>... ranges) Verifies that the givenRangeSet
does not enclose the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).doesNotEnclose(Range.closed(-10, 10), Range.open(150, 160), Range.open(590, 700));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
does not enclose them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
encloses any of the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty.
-
assertDoesNotEnclose
-
doesNotEncloseAnyRangesOf
public RangeSetAssert<T> doesNotEncloseAnyRangesOf(Iterable<com.google.common.collect.Range<T>> ranges) Verifies that the givenRangeSet
does not enclose any of the given ranges.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); assertThat(rangeSet).doesNotEncloseAnyRangesOf(Arrays.asList(Range.closed(-10, 10), Range.open(150, 160), Range.open(590, 700));
- Parameters:
ranges
- the ranges to check whether the actualRangeSet
does not enclose any of them.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
encloses any of the given ranges.NullPointerException
- if ranges are null.IllegalArgumentException
- if ranges are empty.
-
assertDoesNotEncloseAnyRangesOf
-
doesNotEncloseAnyRangesOf
Verifies that the givenRangeSet
does not enclose any range from the given range set.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); rangeSet.add(Range.closed(0, 100)); rangeSet.add(Range.closed(200, 300)); rangeSet.add(Range.closed(500, 600)); RangeSet<Integer> enclosedSet = TreeRangeSet.create(); enclosedSet.add(Range.closed(-10, 10)); enclosedSet.add(Range.open(150, 360)); enclosedSet.add(Range.open(590, 690)); assertThat(rangeSet).doesNotEncloseAnyRangesOf(enclosedSet);
- Parameters:
rangeSet
- the range set to check whether the actualRangeSet
does not enclose any ranges from it.- Returns:
- this
RangeSetAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRangeSet
isnull
.AssertionError
- if the actualRangeSet
encloses any range from the given range set.NullPointerException
- if range set is null.IllegalArgumentException
- if range set is empty.
-
assertDoesNotEncloseAnyRangesOf
-
assertRangeSetDoesNotEncloseGivenValues
-
failIfEmpty
-
failIfEmpty
-
failIfEmpty
private static <T> void failIfEmpty(com.google.common.collect.RangeSet<?> rangeSet)
-