T - the type of the offset value.public class Offset<T extends java.lang.Number>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
boolean |
strict
When |actual-expected|=offset and strict is true the assertThat(actual).isCloseTo(expected, offset); assertion will fail.
|
T |
value |
| Modifier | Constructor and Description |
|---|---|
private |
Offset(T value,
boolean strict) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
static <T extends java.lang.Number> |
offset(T value)
|
static <T extends java.lang.Number> |
strictOffset(T value)
Creates a new strict
Offset that let isCloseTo assertion pass when |actual-expected| < offset value. |
java.lang.String |
toString() |
public final T extends java.lang.Number value
public final boolean strict
private Offset(T value, boolean strict)
public static <T extends java.lang.Number> Offset<T> offset(T value)
Offset that let isCloseTo assertions pass when |actual-expected| <= offset value.
Example:
// assertions succeed
assertThat(8.1).isCloseTo(8.0, offset(0.2));
assertThat(8.1).isCloseTo(8.0, offset(0.1));
// assertion fails
assertThat(8.1).isCloseTo(8.0, offset(0.01));T - the type of value of the Offset.value - the value of the offset.Offset.java.lang.NullPointerException - if the given value is null.java.lang.IllegalArgumentException - if the given value is negative.public static <T extends java.lang.Number> Offset<T> strictOffset(T value)
Offset that let isCloseTo assertion pass when |actual-expected| < offset value.
Examples:
// assertion succeeds
assertThat(8.1).isCloseTo(8.0, offset(0.2));
// assertions fail
assertThat(8.1).isCloseTo(8.0, offset(0.1));
assertThat(8.1).isCloseTo(8.0, offset(0.01));T - the type of value of the Offset.value - the value of the offset.Offset.java.lang.NullPointerException - if the given value is null.java.lang.IllegalArgumentException - if the given value is negative.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object