Package org.assertj.guava.api
Class RangeAssert<T extends java.lang.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:
Assert<RangeAssert<T>,com.google.common.collect.Range<T>>,Descriptable<RangeAssert<T>>,ExtensionPoints<RangeAssert<T>,com.google.common.collect.Range<T>>
public class RangeAssert<T extends java.lang.Comparable<T>> extends 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)
-
-
Field Summary
-
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRangeAssert(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 actualRangecontains the given values.RangeAssert<T>doesNotContain(T... values)Verifies that the actualRangedoes not contain the given values.RangeAssert<T>hasClosedLowerBound()Verifies that the actualRangelower bound is closed.RangeAssert<T>hasClosedUpperBound()Verifies that the actualRangeupper bound is closed.RangeAssert<T>hasLowerEndpointEqualTo(T value)Verifies that the actualRangelower endpoint is equal to the given value.RangeAssert<T>hasOpenedLowerBound()Verifies that the actualRangelower bound is opened.RangeAssert<T>hasOpenedUpperBound()Verifies that the actualRangeupper bound is opened.RangeAssert<T>hasUpperEndpointEqualTo(T value)Verifies that the actualRangeupper endpoint is equal to the given value.RangeAssert<T>isEmpty()Verifies that the actualRangeis empty.RangeAssert<T>isNotEmpty()Verifies that the actualRangeis not 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
-
RangeAssert
protected RangeAssert(com.google.common.collect.Range<T> actual)
-
-
Method Detail
-
contains
public RangeAssert<T> contains(T... values)
Verifies that the actualRangecontains 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
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangedoes not contain the given values.
-
doesNotContain
public RangeAssert<T> doesNotContain(T... values)
Verifies that the actualRangedoes 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
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangecontains the given values.
-
hasClosedLowerBound
public RangeAssert<T> hasClosedLowerBound() throws java.lang.AssertionError
Verifies that the actualRangelower bound is closed.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).hasClosedLowerBound();- Returns:
- this
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangelower bound is opened.
-
hasClosedUpperBound
public RangeAssert<T> hasClosedUpperBound() throws java.lang.AssertionError
Verifies that the actualRangeupper bound is closed.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).hasClosedUpperBound();- Returns:
- this
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangeupper bound is opened.
-
hasLowerEndpointEqualTo
public RangeAssert<T> hasLowerEndpointEqualTo(T value) throws java.lang.AssertionError
Verifies that the actualRangelower endpoint is equal to the given value.
Example :
Range<Integer> range = Range.closed(10, 12); assertThat(range).hasLowerEndpointEqualTo(10);- Parameters:
value-Rangeexpected lower bound value.- Returns:
- this
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangedoes not have lower endpoint equal to the given values.
-
hasOpenedLowerBound
public RangeAssert<T> hasOpenedLowerBound() throws java.lang.AssertionError
Verifies that the actualRangelower bound is opened.
Example :
Range<Integer> range = Range.open(1, 2); assertThat(range).hasOpenedLowerBound();- Returns:
- this
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangelower bound is closed.
-
hasOpenedUpperBound
public RangeAssert<T> hasOpenedUpperBound() throws java.lang.AssertionError
Verifies that the actualRangeupper bound is opened.
Example :
Range<Integer> range = Range.open(10, 12); assertThat(range).hasOpenedUpperBound();- Returns:
- this
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangeupper bound is closed.
-
hasUpperEndpointEqualTo
public RangeAssert<T> hasUpperEndpointEqualTo(T value) throws java.lang.AssertionError
Verifies that the actualRangeupper endpoint is equal to the given value.
Example :
Range<Integer> range = Range.open(10, 12); assertThat(range).hasUpperEndpointEqualTo(12);- Parameters:
value-Rangeexpected upper bound value.- Returns:
- this
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangedoes not have upper endpoint equal to the given values.
-
isEmpty
public RangeAssert<T> isEmpty() throws java.lang.AssertionError
Verifies that the actualRangeis empty.
Example :
Range<Integer> range = Range.closedOpen(0, 0); assertThat(range).isEmpty();- Returns:
- this
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangeis not empty.
-
isNotEmpty
public RangeAssert<T> isNotEmpty() throws java.lang.AssertionError
Verifies that the actualRangeis not empty.
Example :
Range<Integer> range = Range.closed(0, 0); assertThat(range).isNotEmpty();- Returns:
- this
RangeAssertfor assertions chaining. - Throws:
java.lang.AssertionError- if the actualRangeisnull.java.lang.AssertionError- if the actualRangeis empty.
-
-