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:
org.assertj.core.api.Assert<RangeSetAssert<T>,com.google.common.collect.RangeSet<T>>
,org.assertj.core.api.Descriptable<RangeSetAssert<T>>
,org.assertj.core.api.ExtensionPoints<RangeSetAssert<T>,com.google.common.collect.RangeSet<T>>
public class RangeSetAssert<T extends Comparable<T>> extends org.assertj.core.api.AbstractAssert<RangeSetAssert<T>,com.google.common.collect.RangeSet<T>>
Assertion for guavaRangeSet
.To create an instance of this class, invoke
Assertions.assertThat(com.google.common.collect.RangeSet)
- Author:
- Ilya Koshaleu
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RangeSetAssert(com.google.common.collect.RangeSet<T> actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RangeSetAssert<T>
contains(T... ranges)
Verifies that the givenRangeSet
contains the given ranges.RangeSetAssert<T>
containsAll(Iterable<T> ranges)
Verifies that the givenRangeSet
contains all the given ranges.RangeSetAssert<T>
containsAnyOf(T... ranges)
Verifies that the givenRangeSet
contains at least one of the given ranges.RangeSetAssert<T>
containsAnyRangesOf(Iterable<T> ranges)
Verifies that the givenRangeSet
contains at least one of the given ranges.RangeSetAssert<T>
doesNotContain(T... ranges)
Verifies that the givenRangeSet
does not contain any of the given ranges.RangeSetAssert<T>
doesNotContainAll(Iterable<T> ranges)
Verifies that the givenRangeSet
does not contain any of the given ranges.RangeSetAssert<T>
doesNotEnclose(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSet
does not enclose the given ranges.RangeSetAssert<T>
doesNotEncloseAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSet
does not enclose any range from the given range set.RangeSetAssert<T>
doesNotEncloseAnyRangesOf(Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSet
does not enclose any of the given ranges.RangeSetAssert<T>
doesNotIntersect(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSet
does not intersect the given ranges.RangeSetAssert<T>
doesNotIntersectAnyRangeFrom(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSet
does not intersect ranges from the given range set.RangeSetAssert<T>
doesNotIntersectAnyRangeFrom(Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSet
does not intersect all the given ranges.RangeSetAssert<T>
encloses(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSet
encloses the given ranges.RangeSetAssert<T>
enclosesAll(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSet
encloses all ranges from the given range set.RangeSetAssert<T>
enclosesAll(Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSet
encloses all the given ranges.RangeSetAssert<T>
enclosesAnyOf(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSet
encloses at least one of the given ranges.RangeSetAssert<T>
enclosesAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSet
encloses at least one range from the given range set.RangeSetAssert<T>
enclosesAnyRangesOf(Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSet
encloses at least one range of the given ranges.RangeSetAssert<T>
hasSize(int size)
Verifies that the givenRangeSet
has specificsize
of disconnectedRange
elements.RangeSetAssert<T>
intersects(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSet
intersects all the given ranges.RangeSetAssert<T>
intersectsAll(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSet
intersects all the given range set.RangeSetAssert<T>
intersectsAll(Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSet
intersects all the given ranges.RangeSetAssert<T>
intersectsAnyOf(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSet
intersects at least one of the given ranges.RangeSetAssert<T>
intersectsAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSet
intersects at least one range of the given range set.RangeSetAssert<T>
intersectsAnyRangesOf(Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSet
intersects at least one of the given ranges.RangeSetAssert<T>
isEmpty()
Verifies that the actualRangeSet
is empty.RangeSetAssert<T>
isNotEmpty()
Verifies that the actualRangeSet
is not empty.RangeSetAssert<T>
isNullOrEmpty()
Verifies that the actualRangeSet
isnull
or empty.-
Methods inherited from class org.assertj.core.api.AbstractAssert
asInstanceOf, asList, assertionError, asString, 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, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Field Detail
-
rangeSets
RangeSets rangeSets
-
-
Constructor Detail
-
RangeSetAssert
protected RangeSetAssert(com.google.common.collect.RangeSet<T> actual)
-
-
Method Detail
-
hasSize
public RangeSetAssert<T> hasSize(int size)
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
.
-
contains
@SafeVarargs public final RangeSetAssert<T> contains(T... ranges)
Verifies that the givenRangeSet
contains 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).contains(50, 270, 550);
- Parameters:
ranges
- the ranges 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 givenranges
.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
containsAll
public RangeSetAssert<T> containsAll(Iterable<T> ranges)
Verifies that the givenRangeSet
contains 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).containsAll(Arrays.asList(50, 270, 550));
- Parameters:
ranges
- the ranges 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 givenranges
.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
containsAnyOf
@SafeVarargs public final RangeSetAssert<T> containsAnyOf(T... ranges)
Verifies that the givenRangeSet
contains 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).containsAnyOf(150, 250, 700);
- Parameters:
ranges
- the ranges 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 givenranges
.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
containsAnyRangesOf
public RangeSetAssert<T> containsAnyRangesOf(Iterable<T> ranges)
Verifies that the givenRangeSet
contains 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).containsAnyRangesOf(Arrays.asList(150, 250, 700));
- Parameters:
ranges
- the ranges 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 givenranges
.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
doesNotContain
@SafeVarargs public final RangeSetAssert<T> doesNotContain(T... ranges)
Verifies that the givenRangeSet
does not contain 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).doesNotContain(150, 320, 650);
- Parameters:
ranges
- the ranges 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 givenranges
.IllegalArgumentException
- if ranges are null or ranges are empty.
-
doesNotContainAll
public RangeSetAssert<T> doesNotContainAll(Iterable<T> ranges)
Verifies that the givenRangeSet
does not contain 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).doesNotContain(Arrays.asList(150, 320, 650));
- Parameters:
ranges
- the ranges 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 givenranges
.IllegalArgumentException
- if ranges are null or ranges are empty.
-
isEmpty
public RangeSetAssert<T> 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.
-
isNotEmpty
public RangeSetAssert<T> 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.
-
isNullOrEmpty
public RangeSetAssert<T> 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.
-
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
intersectsAll
public RangeSetAssert<T> intersectsAll(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSet
intersects all 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.IllegalArgumentException
- if range set is null or it is empty while actual is not empty.
-
intersectsAll
public RangeSetAssert<T> intersectsAll(Iterable<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).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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
intersectsAnyRangesOf
public RangeSetAssert<T> intersectsAnyRangesOf(Iterable<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).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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
intersectsAnyRangesOf
public RangeSetAssert<T> intersectsAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
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.IllegalArgumentException
- if range set is null or it is empty while actual is not empty.
-
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
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.IllegalArgumentException
- if range set is null or it is empty while actual is not empty.
-
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
encloses
@SafeVarargs public final RangeSetAssert<T> encloses(com.google.common.collect.Range<T>... ranges)
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
enclosesAll
public RangeSetAssert<T> enclosesAll(Iterable<com.google.common.collect.Range<T>> ranges)
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
enclosesAll
public RangeSetAssert<T> enclosesAll(com.google.common.collect.RangeSet<T> rangeSet)
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.IllegalArgumentException
- if range set is null or it is empty while actual is not empty.
-
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
enclosesAnyRangesOf
public RangeSetAssert<T> enclosesAnyRangesOf(Iterable<com.google.common.collect.Range<T>> ranges)
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
enclosesAnyRangesOf
public RangeSetAssert<T> enclosesAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
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.IllegalArgumentException
- if range set is null or it is empty while actual is not empty.
-
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
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.IllegalArgumentException
- if ranges are null or ranges are empty while actual is not empty.
-
doesNotEncloseAnyRangesOf
public RangeSetAssert<T> doesNotEncloseAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
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.IllegalArgumentException
- if range set is null or it is empty while actual is not empty.
-
-