Package org.assertj.guava.api
Class RangeSetAssert<T extends java.lang.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 java.lang.Comparable<T>> extends AbstractAssert<RangeSetAssert<T>,com.google.common.collect.RangeSet<T>>
Assertion for guavaRangeSet.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
Constructors Modifier Constructor Description protectedRangeSetAssert(com.google.common.collect.RangeSet<T> actual)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidassertContains(T[] values)private voidassertContainsAll(java.lang.Iterable<T> values)private voidassertContainsAnyOf(T[] values)private voidassertContainsAnyRangesOf(java.lang.Iterable<T> values)private voidassertDoesNotContain(T[] values)private voidassertDoesNotContainAll(java.lang.Iterable<T> values)private voidassertDoesNotEnclose(com.google.common.collect.Range<T>[] ranges)private voidassertDoesNotEncloseAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)private voidassertDoesNotEncloseAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)private voidassertDoesNotIntersect(com.google.common.collect.Range<T>[] ranges)private voidassertDoesNotIntersectAnyRangeFrom(com.google.common.collect.RangeSet<T> rangeSet)private voidassertDoesNotIntersectAnyRangeFrom(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)private voidassertEmpty()private voidassertEncloses(com.google.common.collect.Range<T>[] ranges)private voidassertEnclosesAll(com.google.common.collect.RangeSet<T> rangeSet)private voidassertEnclosesAll(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)private voidassertEnclosesAnyOf(com.google.common.collect.Range<T>[] ranges)private voidassertEnclosesAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)private voidassertEnclosesAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)private voidassertHasSize(int expectedSize)private voidassertIntersects(com.google.common.collect.Range<T>[] ranges)private voidassertIntersectsAll(com.google.common.collect.RangeSet<T> rangeSet)private voidassertIntersectsAll(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)private voidassertIntersectsAnyOf(com.google.common.collect.Range<T>[] ranges)private voidassertIntersectsAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)private voidassertIntersectsAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)private voidassertNotEmpty()private voidassertNullOrEmpty()private voidassertRangeSetContainsAnyGivenValues(com.google.common.collect.RangeSet actual, java.lang.Comparable[] values)private voidassertRangeSetContainsGivenValues(com.google.common.collect.RangeSet actual, java.lang.Comparable[] values)private voidassertRangeSetDoesNotContainGivenValues(com.google.common.collect.RangeSet actual, java.lang.Comparable[] values)private voidassertRangeSetDoesNotEncloseGivenValues(com.google.common.collect.Range<T>[] ranges)private voidassertRangeSetDoesNotIntersectGivenValues(com.google.common.collect.Range<T>[] ranges)private voidassertRangeSetEnclosesAnyOfGivenValues(com.google.common.collect.Range<T>[] ranges)private voidassertRangeSetEnclosesGivenValues(com.google.common.collect.Range<T>[] ranges)private voidassertRangeSetIntersectsAnyOfGivenValues(com.google.common.collect.Range<T>[] ranges)private voidassertRangeSetIntersectsGivenValues(com.google.common.collect.Range<T>[] ranges)RangeSetAssert<T>contains(T... values)Verifies that the givenRangeSetcontains the given values.RangeSetAssert<T>containsAll(java.lang.Iterable<T> values)Verifies that the givenRangeSetcontains all the given values.RangeSetAssert<T>containsAnyOf(T... values)Verifies that the givenRangeSetcontains at least one of the given values.RangeSetAssert<T>containsAnyRangesOf(java.lang.Iterable<T> values)Verifies that the givenRangeSetcontains at least one of the given values.RangeSetAssert<T>doesNotContain(T... values)Verifies that the givenRangeSetdoes not contain any of the given values.RangeSetAssert<T>doesNotContainAll(java.lang.Iterable<T> values)Verifies that the givenRangeSetdoes not contain any of the given values.RangeSetAssert<T>doesNotEnclose(com.google.common.collect.Range<T>... ranges)Verifies that the givenRangeSetdoes not enclose the given ranges.RangeSetAssert<T>doesNotEncloseAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)Verifies that the givenRangeSetdoes not enclose any range from the given range set.RangeSetAssert<T>doesNotEncloseAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)Verifies that the givenRangeSetdoes not enclose any of the given ranges.RangeSetAssert<T>doesNotIntersect(com.google.common.collect.Range<T>... ranges)Verifies that the givenRangeSetdoes not intersect the given ranges.RangeSetAssert<T>doesNotIntersectAnyRangeFrom(com.google.common.collect.RangeSet<T> rangeSet)Verifies that the givenRangeSetdoes not intersect ranges from the given range set.RangeSetAssert<T>doesNotIntersectAnyRangeFrom(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)Verifies that the givenRangeSetdoes not intersect all the given ranges.RangeSetAssert<T>encloses(com.google.common.collect.Range<T>... ranges)Verifies that the givenRangeSetencloses the given ranges.RangeSetAssert<T>enclosesAll(com.google.common.collect.RangeSet<T> rangeSet)Verifies that the givenRangeSetencloses all ranges from the given range set.RangeSetAssert<T>enclosesAll(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)Verifies that the givenRangeSetencloses all the given ranges.RangeSetAssert<T>enclosesAnyOf(com.google.common.collect.Range<T>... ranges)Verifies that the givenRangeSetencloses at least one of the given ranges.RangeSetAssert<T>enclosesAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)Verifies that the givenRangeSetencloses at least one range from the given range set.RangeSetAssert<T>enclosesAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)Verifies that the givenRangeSetencloses at least one range of the given ranges.private static <T> voidfailIfEmpty(com.google.common.collect.RangeSet<?> rangeSet)private static <T> voidfailIfEmpty(java.lang.Iterable<T> iterable, java.lang.String label)private static <T> voidfailIfEmpty(T[] array, java.lang.String label)RangeSetAssert<T>hasSize(int size)Verifies that the givenRangeSethas specificsizeof disconnectedRangeelements.RangeSetAssert<T>intersects(com.google.common.collect.Range<T>... ranges)Verifies that the givenRangeSetintersects all the given ranges.RangeSetAssert<T>intersectsAll(com.google.common.collect.RangeSet<T> rangeSet)Verifies that the givenRangeSetintersects all ranges from the given range set.RangeSetAssert<T>intersectsAll(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)Verifies that the givenRangeSetintersects all the given ranges.RangeSetAssert<T>intersectsAnyOf(com.google.common.collect.Range<T>... ranges)Verifies that the givenRangeSetintersects at least one of the given ranges.RangeSetAssert<T>intersectsAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)Verifies that the givenRangeSetintersects at least one range of the given range set.RangeSetAssert<T>intersectsAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)Verifies that the givenRangeSetintersects at least one of the given ranges.RangeSetAssert<T>isEmpty()Verifies that the actualRangeSetis empty.RangeSetAssert<T>isNotEmpty()Verifies that the actualRangeSetis not empty.RangeSetAssert<T>isNullOrEmpty()Verifies that the actualRangeSetisnullor empty.-
Methods inherited from class org.assertj.core.api.AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, 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, usingEquals, usingEquals, 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, describedAs
-
-
-
-
Constructor Detail
-
RangeSetAssert
protected RangeSetAssert(com.google.common.collect.RangeSet<T> actual)
-
-
Method Detail
-
hasSize
public RangeSetAssert<T> hasSize(int size)
Verifies that the givenRangeSethas specificsizeof disconnectedRangeelements.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 disconnectedRangeelements.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actual size ofRangeSetis different from the expectedsize.
-
assertHasSize
private void assertHasSize(int expectedSize)
-
contains
@SafeVarargs public final RangeSetAssert<T> contains(T... values)
Verifies that the givenRangeSetcontains 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not contain the givenvalues.java.lang.NullPointerException- if values are null.java.lang.IllegalArgumentException- if values are empty while actual is not empty.
-
assertContains
private void assertContains(T[] values)
-
containsAll
public RangeSetAssert<T> containsAll(java.lang.Iterable<T> values)
Verifies that the givenRangeSetcontains 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not contain all the givenvalues.java.lang.NullPointerException- if values are null.java.lang.IllegalArgumentException- if values are empty while actual is not empty.
-
assertContainsAll
private void assertContainsAll(java.lang.Iterable<T> values)
-
assertRangeSetContainsGivenValues
private void assertRangeSetContainsGivenValues(com.google.common.collect.RangeSet actual, java.lang.Comparable[] values)
-
containsAnyOf
@SafeVarargs public final RangeSetAssert<T> containsAnyOf(T... values)
Verifies that the givenRangeSetcontains 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not contain at least one of the givenvalues.java.lang.NullPointerException- if values are null.java.lang.IllegalArgumentException- if values are empty while actual is not empty.
-
assertContainsAnyOf
private void assertContainsAnyOf(T[] values)
-
containsAnyRangesOf
public RangeSetAssert<T> containsAnyRangesOf(java.lang.Iterable<T> values)
Verifies that the givenRangeSetcontains 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not contain at least one of the givenvalues.java.lang.NullPointerException- if values are null.java.lang.IllegalArgumentException- if values are empty while actual is not empty.
-
assertContainsAnyRangesOf
private void assertContainsAnyRangesOf(java.lang.Iterable<T> values)
-
assertRangeSetContainsAnyGivenValues
private void assertRangeSetContainsAnyGivenValues(com.google.common.collect.RangeSet actual, java.lang.Comparable[] values)
-
doesNotContain
@SafeVarargs public final RangeSetAssert<T> doesNotContain(T... values)
Verifies that the givenRangeSetdoes 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetcontains any of the givenvalues.java.lang.NullPointerException- if values are null.java.lang.IllegalArgumentException- if values are empty.
-
assertDoesNotContain
private void assertDoesNotContain(T[] values)
-
doesNotContainAll
public RangeSetAssert<T> doesNotContainAll(java.lang.Iterable<T> values)
Verifies that the givenRangeSetdoes 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetcontains any of the givenvalues.java.lang.NullPointerException- if values are null.java.lang.IllegalArgumentException- if values are empty.
-
assertDoesNotContainAll
private void assertDoesNotContainAll(java.lang.Iterable<T> values)
-
assertRangeSetDoesNotContainGivenValues
private void assertRangeSetDoesNotContainGivenValues(com.google.common.collect.RangeSet actual, java.lang.Comparable[] values)
-
isEmpty
public RangeSetAssert<T> isEmpty()
Verifies that the actualRangeSetis empty.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); assertThat(rangeSet).isEmpty();- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetis not empty.
-
assertEmpty
private void assertEmpty()
-
isNotEmpty
public RangeSetAssert<T> isNotEmpty()
Verifies that the actualRangeSetis 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetis empty.
-
assertNotEmpty
private void assertNotEmpty()
-
isNullOrEmpty
public RangeSetAssert<T> isNullOrEmpty()
Verifies that the actualRangeSetisnullor empty.Example:
RangeSet<Integer> rangeSet = TreeRangeSet.create(); assertThat(rangeSet).isNullOrEmpty();- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetis notnullor not empty.
-
assertNullOrEmpty
private void assertNullOrEmpty()
-
intersects
@SafeVarargs public final RangeSetAssert<T> intersects(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSetintersects 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not intersect all the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty while actual is not empty.
-
assertIntersects
private void assertIntersects(com.google.common.collect.Range<T>[] ranges)
-
intersectsAll
public RangeSetAssert<T> intersectsAll(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSetintersects 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not intersect all the ranges from the given range set.java.lang.NullPointerException- if range set is null.java.lang.IllegalArgumentException- if range set is empty while actual is not empty.
-
assertIntersectsAll
private void assertIntersectsAll(com.google.common.collect.RangeSet<T> rangeSet)
-
intersectsAll
public RangeSetAssert<T> intersectsAll(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSetintersects 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
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not intersect all the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty while actual is not empty.
-
assertIntersectsAll
private void assertIntersectsAll(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
-
assertRangeSetIntersectsGivenValues
private void assertRangeSetIntersectsGivenValues(com.google.common.collect.Range<T>[] ranges)
-
intersectsAnyOf
@SafeVarargs public final RangeSetAssert<T> intersectsAnyOf(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSetintersects 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 actualRangeSetintersects at least one of them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not intersect any of the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty while actual is not empty.
-
assertIntersectsAnyOf
private void assertIntersectsAnyOf(com.google.common.collect.Range<T>[] ranges)
-
intersectsAnyRangesOf
public RangeSetAssert<T> intersectsAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSetintersects 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 actualRangeSetintersects at least one of them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not intersect any of the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty while actual is not empty.
-
assertIntersectsAnyRangesOf
private void assertIntersectsAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
-
intersectsAnyRangesOf
public RangeSetAssert<T> intersectsAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSetintersects 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 actualRangeSetintersects at least one of them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not intersect any of the ranges from the given ranges set.java.lang.NullPointerException- if range set is null.java.lang.IllegalArgumentException- if range set is empty while actual is not empty.
-
assertIntersectsAnyRangesOf
private void assertIntersectsAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
-
assertRangeSetIntersectsAnyOfGivenValues
private void assertRangeSetIntersectsAnyOfGivenValues(com.google.common.collect.Range<T>[] ranges)
-
doesNotIntersect
@SafeVarargs public final RangeSetAssert<T> doesNotIntersect(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSetdoes 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 actualRangeSetdoes not intersect them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetintersects the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty.
-
assertDoesNotIntersect
private void assertDoesNotIntersect(com.google.common.collect.Range<T>[] ranges)
-
doesNotIntersectAnyRangeFrom
public RangeSetAssert<T> doesNotIntersectAnyRangeFrom(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSetdoes 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 actualRangeSetdoes not intersect ranges from it.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetintersects the ranges from the given range set.java.lang.NullPointerException- if range set is null.java.lang.IllegalArgumentException- if range set is empty.
-
assertDoesNotIntersectAnyRangeFrom
private void assertDoesNotIntersectAnyRangeFrom(com.google.common.collect.RangeSet<T> rangeSet)
-
doesNotIntersectAnyRangeFrom
public RangeSetAssert<T> doesNotIntersectAnyRangeFrom(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSetdoes 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 actualRangeSetdoes not intersect them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetintersects all the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty.
-
assertDoesNotIntersectAnyRangeFrom
private void assertDoesNotIntersectAnyRangeFrom(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
-
assertRangeSetDoesNotIntersectGivenValues
private void assertRangeSetDoesNotIntersectGivenValues(com.google.common.collect.Range<T>[] ranges)
-
encloses
@SafeVarargs public final RangeSetAssert<T> encloses(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSetencloses 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 actualRangeSetencloses them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not enclose the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty while actual is not empty.
-
assertEncloses
private void assertEncloses(com.google.common.collect.Range<T>[] ranges)
-
enclosesAll
public RangeSetAssert<T> enclosesAll(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSetencloses 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 actualRangeSetencloses all of them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not enclose all the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty while actual is not empty.
-
assertEnclosesAll
private void assertEnclosesAll(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
-
enclosesAll
public RangeSetAssert<T> enclosesAll(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSetencloses 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 actualRangeSetencloses all range from it.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not enclose all ranges from the given range set.java.lang.NullPointerException- if range set is null.java.lang.IllegalArgumentException- if range set is empty while actual is not empty.
-
assertEnclosesAll
private void assertEnclosesAll(com.google.common.collect.RangeSet<T> rangeSet)
-
assertRangeSetEnclosesGivenValues
private void assertRangeSetEnclosesGivenValues(com.google.common.collect.Range<T>[] ranges)
-
enclosesAnyOf
@SafeVarargs public final RangeSetAssert<T> enclosesAnyOf(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSetencloses 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 actualRangeSetencloses at least one of them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not enclose at least one of the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty while actual is not empty.
-
assertEnclosesAnyOf
private void assertEnclosesAnyOf(com.google.common.collect.Range<T>[] ranges)
-
enclosesAnyRangesOf
public RangeSetAssert<T> enclosesAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSetencloses 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 actualRangeSetencloses at least one of them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not enclose at least one of the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty while actual is not empty.
-
assertEnclosesAnyRangesOf
private void assertEnclosesAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
-
enclosesAnyRangesOf
public RangeSetAssert<T> enclosesAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSetencloses 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 actualRangeSetencloses at least one range from it.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetdoes not enclose at least one range from the given range set.java.lang.NullPointerException- if range set is null.java.lang.IllegalArgumentException- if range set is empty while actual is not empty.
-
assertEnclosesAnyRangesOf
private void assertEnclosesAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
-
assertRangeSetEnclosesAnyOfGivenValues
private void assertRangeSetEnclosesAnyOfGivenValues(com.google.common.collect.Range<T>[] ranges)
-
doesNotEnclose
@SafeVarargs public final RangeSetAssert<T> doesNotEnclose(com.google.common.collect.Range<T>... ranges)
Verifies that the givenRangeSetdoes 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 actualRangeSetdoes not enclose them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetencloses any of the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty.
-
assertDoesNotEnclose
private void assertDoesNotEnclose(com.google.common.collect.Range<T>[] ranges)
-
doesNotEncloseAnyRangesOf
public RangeSetAssert<T> doesNotEncloseAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
Verifies that the givenRangeSetdoes 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 actualRangeSetdoes not enclose any of them.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetencloses any of the given ranges.java.lang.NullPointerException- if ranges are null.java.lang.IllegalArgumentException- if ranges are empty.
-
assertDoesNotEncloseAnyRangesOf
private void assertDoesNotEncloseAnyRangesOf(java.lang.Iterable<com.google.common.collect.Range<T>> ranges)
-
doesNotEncloseAnyRangesOf
public RangeSetAssert<T> doesNotEncloseAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
Verifies that the givenRangeSetdoes 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 actualRangeSetdoes not enclose any ranges from it.- Returns:
- this
RangeSetAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeSetisnull.java.lang.AssertionError- if the actualRangeSetencloses any range from the given range set.java.lang.NullPointerException- if range set is null.java.lang.IllegalArgumentException- if range set is empty.
-
assertDoesNotEncloseAnyRangesOf
private void assertDoesNotEncloseAnyRangesOf(com.google.common.collect.RangeSet<T> rangeSet)
-
assertRangeSetDoesNotEncloseGivenValues
private void assertRangeSetDoesNotEncloseGivenValues(com.google.common.collect.Range<T>[] ranges)
-
failIfEmpty
private static <T> void failIfEmpty(T[] array, java.lang.String label)
-
failIfEmpty
private static <T> void failIfEmpty(java.lang.Iterable<T> iterable, java.lang.String label)
-
failIfEmpty
private static <T> void failIfEmpty(com.google.common.collect.RangeSet<?> rangeSet)
-
-