Package org.assertj.guava.api
Class RangeAssert<T extends Comparable<T>>
- Type Parameters:
T
- the type of elements of the tested Range value
- All Implemented Interfaces:
Assert<RangeAssert<T>,
,Range<T>> Descriptable<RangeAssert<T>>
,ExtensionPoints<RangeAssert<T>,
Range<T>>
Assertions for guava
Range
.
To create an instance of this class, invoke Assertions.assertThat(com.google.common.collect.Range)
- Author:
- Marcin KwaczyĆski
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionVerifies that the actualRange
contains the given values.doesNotContain
(T... values) Verifies that the actualRange
does not contain the given values.Verifies that the actualRange
lower bound is closed.Verifies that the actualRange
upper bound is closed.hasLowerEndpointEqualTo
(T value) Verifies that the actualRange
lower endpoint is equal to the given value.Verifies that the actualRange
lower bound is opened.Verifies that the actualRange
upper bound is opened.hasUpperEndpointEqualTo
(T value) Verifies that the actualRange
upper endpoint is equal to the given value.isEmpty()
Verifies that the actualRange
is empty.Verifies that the actualRange
is not empty.Methods inherited from class org.assertj.core.api.AbstractAssert
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, 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, 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 Details
-
RangeAssert
-
-
Method Details
-
contains
Verifies that the actualRange
contains the given values.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).contains(10, 11, 12);
- Parameters:
values
- the values to look for in actualRange
.- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
does not contain the given values.
-
doesNotContain
Verifies that the actualRange
does not contain the given values.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).doesNotContain(13);
- Parameters:
values
- the values that should not be present in actualRange
.- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
contains the given values.
-
hasClosedLowerBound
Verifies that the actualRange
lower bound is closed.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).hasClosedLowerBound();
- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
lower bound is opened.
-
hasClosedUpperBound
Verifies that the actualRange
upper bound is closed.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).hasClosedUpperBound();
- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
upper bound is opened.
-
hasLowerEndpointEqualTo
Verifies that the actualRange
lower endpoint is equal to the given value.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).hasLowerEndpointEqualTo(10);
- Parameters:
value
-Range
expected lower bound value.- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
does not have lower endpoint equal to the given values.
-
hasOpenedLowerBound
Verifies that the actualRange
lower bound is opened.
Example :
Range<Integer> range = Range.open(1, 2); assertThat(range).hasOpenedLowerBound();
- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
lower bound is closed.
-
hasOpenedUpperBound
Verifies that the actualRange
upper bound is opened.
Example :
Range<Integer> range = Range.open(10, 12); assertThat(range).hasOpenedUpperBound();
- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
upper bound is closed.
-
hasUpperEndpointEqualTo
Verifies that the actualRange
upper endpoint is equal to the given value.
Example :
Range<Integer> range = Range.open(10, 12); assertThat(range).hasUpperEndpointEqualTo(12);
- Parameters:
value
-Range
expected upper bound value.- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
does not have upper endpoint equal to the given values.
-
isEmpty
Verifies that the actualRange
is empty.
Example :
Range<Integer> range = Range.closedOpen(0, 0); assertThat(range).isEmpty();
- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
is not empty.
-
isNotEmpty
Verifies that the actualRange
is not empty.
Example :
Range<Integer> range = Range.closed(0, 0); assertThat(range).isNotEmpty();
- Returns:
- this
RangeAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
is empty.
-