Package org.assertj.guava.api
Class RangeAssert<T extends Comparable<T>>
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<RangeAssert<T>,com.google.common.collect.Range<T>>
-
- org.assertj.guava.api.RangeAssert<T>
-
- Type Parameters:
T
- the type of elements of the tested Range value
- All Implemented Interfaces:
org.assertj.core.api.Assert<RangeAssert<T>,com.google.common.collect.Range<T>>
,org.assertj.core.api.Descriptable<RangeAssert<T>>
,org.assertj.core.api.ExtensionPoints<RangeAssert<T>,com.google.common.collect.Range<T>>
public class RangeAssert<T extends Comparable<T>> extends org.assertj.core.api.AbstractAssert<RangeAssert<T>,com.google.common.collect.Range<T>>
Assertions for guavaRange
.To create an instance of this class, invoke
Assertions.assertThat(com.google.common.collect.Range)
- Author:
- Marcin KwaczyĆski
-
-
Field Summary
Fields Modifier and Type Field Description (package private) org.assertj.core.internal.Failures
failures
-
Constructor Summary
Constructors Modifier Constructor Description protected
RangeAssert(com.google.common.collect.Range<T> actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RangeAssert<T>
contains(T... values)
Verifies that the actualRange
contains the given values.RangeAssert<T>
doesNotContain(T... values)
Verifies that the actualRange
does not contain the given values.RangeAssert<T>
hasClosedLowerBound()
Verifies that the actualRange
lower bound is closed.RangeAssert<T>
hasClosedUpperBound()
Verifies that the actualRange
upper bound is closed.RangeAssert<T>
hasLowerEndpointEqualTo(T value)
Verifies that the actualRange
lower endpoint is equal to the given value.RangeAssert<T>
hasOpenedLowerBound()
Verifies that the actualRange
lower bound is opened.RangeAssert<T>
hasOpenedUpperBound()
Verifies that the actualRange
upper bound is opened.RangeAssert<T>
hasUpperEndpointEqualTo(T value)
Verifies that the actualRange
upper endpoint is equal to the given value.RangeAssert<T>
isEmpty()
Verifies that the actualRange
is empty.RangeAssert<T>
isNotEmpty()
Verifies that the actualRange
is not empty.-
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asInstanceOf, 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, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Constructor Detail
-
RangeAssert
protected RangeAssert(com.google.common.collect.Range<T> actual)
-
-
Method Detail
-
contains
public RangeAssert<T> contains(T... values)
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
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
does not contain the given values.
-
doesNotContain
public RangeAssert<T> doesNotContain(T... values)
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 to look for in actualRange
.- Returns:
- this
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
contains the given values.
-
hasClosedLowerBound
public RangeAssert<T> hasClosedLowerBound() throws AssertionError
Verifies that the actualRange
lower bound is closed.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).hasClosedLowerBound();
- Returns:
- this
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
lower bound is opened.
-
hasClosedUpperBound
public RangeAssert<T> hasClosedUpperBound() throws AssertionError
Verifies that the actualRange
upper bound is closed.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).hasClosedUpperBound();
- Returns:
- this
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
upper bound is opened.
-
hasLowerEndpointEqualTo
public RangeAssert<T> hasLowerEndpointEqualTo(T value) throws AssertionError
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
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
does not have lower endpoint equal to the given values.
-
hasOpenedLowerBound
public RangeAssert<T> hasOpenedLowerBound() throws AssertionError
Verifies that the actualRange
lower bound is opened.
Example :
Range<Integer> range = Range.open(1, 2); assertThat(range).hasOpenedLowerBound();
- Returns:
- this
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
lower bound is closed.
-
hasOpenedUpperBound
public RangeAssert<T> hasOpenedUpperBound() throws AssertionError
Verifies that the actualRange
upper bound is opened.
Example :
Range<Integer> range = Range.open(10, 12); assertThat(range).hasOpenedUpperBound();
- Returns:
- this
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
upper bound is closed.
-
hasUpperEndpointEqualTo
public RangeAssert<T> hasUpperEndpointEqualTo(T value) throws AssertionError
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
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
does not have upper endpoint equal to the given values.
-
isEmpty
public RangeAssert<T> isEmpty() throws AssertionError
Verifies that the actualRange
is empty.
Example :
Range<Integer> range = Range.closedOpen(0, 0); assertThat(range).isEmpty();
- Returns:
- this
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
is not empty.
-
isNotEmpty
public RangeAssert<T> isNotEmpty() throws AssertionError
Verifies that the actualRange
is not empty.
Example :
Range<Integer> range = Range.closed(0, 0); assertThat(range).isNotEmpty();
- Returns:
- this
OptionalAssert
for assertions chaining. - Throws:
AssertionError
- if the actualRange
isnull
.AssertionError
- if the actualRange
is empty.
-
-