T
- the type of elements of the tested Range valuepublic class RangeAssert<T extends Comparable<T>> extends org.assertj.core.api.AbstractAssert<RangeAssert<T>,com.google.common.collect.Range<T>>
Range
.
To create an instance of this class, invoke Assertions.assertThat(com.google.common.collect.Range)
Modifier | Constructor and Description |
---|---|
protected |
RangeAssert(com.google.common.collect.Range<T> actual) |
Modifier and Type | Method and Description |
---|---|
RangeAssert<T> |
contains(T... values)
Verifies that the actual
Range contains the given values. |
RangeAssert<T> |
doesNotContain(T... values)
Verifies that the actual
Range does not contain the given values. |
RangeAssert<T> |
hasClosedLowerBound()
Verifies that the actual
Range lower bound is closed. |
RangeAssert<T> |
hasClosedUpperBound()
Verifies that the actual
Range upper bound is closed. |
RangeAssert<T> |
hasLowerEndpointEqualTo(T value)
Verifies that the actual
Range lower endpoint is equal to the given value. |
RangeAssert<T> |
hasOpenedLowerBound()
Verifies that the actual
Range lower bound is opened. |
RangeAssert<T> |
hasOpenedUpperBound()
Verifies that the actual
Range upper bound is opened. |
RangeAssert<T> |
hasUpperEndpointEqualTo(T value)
Verifies that the actual
Range upper endpoint is equal to the given value. |
RangeAssert<T> |
isEmpty()
Verifies that the actual
Range is empty. |
RangeAssert<T> |
isNotEmpty()
Verifies that the actual
Range is not empty. |
as, as, asList, asString, describedAs, 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, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
protected RangeAssert(com.google.common.collect.Range<T> actual)
public RangeAssert<T> contains(T... values)
Range
contains the given values.Example :
Range<Integer> range = Range.closed(10, 12);
assertThat(range).contains(10, 11, 12);
values
- the values to look for in actual Range
.OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
does not contain the given values.public RangeAssert<T> doesNotContain(T... values)
Range
does not contain the given values.Example :
Range<Integer> range = Range.closed(10, 12);
assertThat(range).doesNotContain(13);
values
- the values to look for in actual Range
.OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
contains the given values.public RangeAssert<T> hasClosedLowerBound() throws AssertionError
Range
lower bound is closed.Example :
Range<Integer> range = Range.closed(10, 12);
assertThat(range).hasClosedLowerBound();
OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
lower bound is opened.public RangeAssert<T> hasClosedUpperBound() throws AssertionError
Range
upper bound is closed.Example :
Range<Integer> range = Range.closed(10, 12);
assertThat(range).hasClosedUpperBound();
OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
upper bound is opened.public RangeAssert<T> hasLowerEndpointEqualTo(T value) throws AssertionError
Range
lower endpoint is equal to the given value.Example :
Range<Integer> range = Range.closed(10, 12);
assertThat(range).hasLowerEndpointEqualTo(10);
value
- Range
expected lower bound value.OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
does not have lower endpoint equal to
the given values.public RangeAssert<T> hasOpenedLowerBound() throws AssertionError
Range
lower bound is opened.Example :
Range<Integer> range = Range.open(1, 2);
assertThat(range).hasOpenedLowerBound();
OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
lower bound is closed.public RangeAssert<T> hasOpenedUpperBound() throws AssertionError
Range
upper bound is opened.Example :
Range<Integer> range = Range.open(10, 12);
assertThat(range).hasOpenedUpperBound();
OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
upper bound is closed.public RangeAssert<T> hasUpperEndpointEqualTo(T value) throws AssertionError
Range
upper endpoint is equal to the given value.Example :
Range<Integer> range = Range.open(10, 12);
assertThat(range).hasUpperEndpointEqualTo(12);
value
- Range
expected upper bound value.OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
does not have upper endpoint equal to
the given values.public RangeAssert<T> isEmpty() throws AssertionError
Range
is empty.Example :
Range<Integer> range = Range.closedOpen(0, 0);
assertThat(range).isEmpty();
OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
is not empty.public RangeAssert<T> isNotEmpty() throws AssertionError
Range
is not empty.Example :
Range<Integer> range = Range.closed(0, 0);
assertThat(range).isNotEmpty();
OptionalAssert
for assertions chaining.AssertionError
- if the actual Range
is null
.AssertionError
- if the actual Range
is empty.Copyright © 2018 AssertJ. All rights reserved.