| 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 and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
static <T extends Number> |
offset(T value)
|
static <T extends Number> |
strictOffset(T value)
Creates a new strict
Offset that let isCloseTo assertion pass when |actual-expected| < offset value. |
String |
toString() |
public final boolean strict
public static <T extends 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.NullPointerException - if the given value is null.IllegalArgumentException - if the given value is negative.public static <T extends 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.NullPointerException - if the given value is null.IllegalArgumentException - if the given value is negative.Copyright © 2014–2019 AssertJ. All rights reserved.