T
- The "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation"
for more details.public interface AssertOnValueCloseness<T extends AssertOnValueCloseness<T>>
Modifier and Type | Method and Description |
---|---|
T |
isCloseTo(DateTimeValue expected,
DateTimeValue tolerance)
Verifies that the value is close to a date/time.
|
T |
isCloseTo(DateTimeValue expected,
DateValue tolerance)
Verifies that the value is close to a date/time.
|
T |
isCloseTo(DateTimeValue expected,
TimeValue tolerance)
Verifies that the value is close to a date/time.
|
T |
isCloseTo(DateValue expected,
DateTimeValue tolerance)
Verifies that the value is close to a date.
|
T |
isCloseTo(DateValue expected,
DateValue tolerance)
Verifies that the value is close to a date.
|
T |
isCloseTo(DateValue expected,
TimeValue tolerance)
Verifies that the value is close to a date.
|
T |
isCloseTo(Number expected,
Number tolerance)
Verifies that the value is close to a number.
|
T |
isCloseTo(TimeValue expected,
TimeValue tolerance)
Verifies that the value is close to a time.
|
T isCloseTo(Number expected, Number tolerance)
Example where the assertion verifies that the value in the first Column
of the first Row
of the
Table
is close to number 3 with a tolerance of 1 (that means that all the numbers between 2 and 4
included are close enough) :
assertThat(table).row().value().isCloseTo(3, 1);
Example where the assertion verifies that the value in the first Column
of the Row
at end point
of the first Change
is close to number 3 with a tolerance of 0.75 :
assertThat(changes).change().rowAtEndPoint().value().isCloseTo(3, 0.75);
expected
- The expected number value.tolerance
- The tolerance of the closeness.this
assertion object.AssertionError
- If the value is not close to the number in parameter.AbstractValueAssert.isCloseTo(Number, Number)
,
AbstractAssertWithValues.isCloseTo(Number, Number)
T isCloseTo(DateValue expected, DateValue tolerance)
Example where the assertion verifies that the value in the first Column
of the first Row
of the
Table
is close to a date value with a tolerance of 2 days :
assertThat(table).row().value().isCloseTo(DateValue.of(2014, 7, 7), DateValue.of(0, 0, 2));
Example where the assertion verifies that the value in the first Column
of the Row
at end point
of the first Change
is close to a date value with a tolerance of 2 days :
assertThat(changes).change().rowAtEndPoint().value().isCloseTo(DateValue.of(2014, 7, 7), DateValue.of(0, 0, 2));
expected
- The expected date value.tolerance
- The tolerance of the closeness.this
assertion object.AssertionError
- If the value is not close to the date in parameter.AbstractValueAssert.isCloseTo(DateValue, DateValue)
,
AbstractAssertWithValues.isCloseTo(DateValue, DateValue)
T isCloseTo(DateValue expected, TimeValue tolerance)
Example where the assertion verifies that the value in the first Column
of the first Row
of the
Table
is close to a date value with a tolerance of 1 hour :
assertThat(table).row().value().isCloseTo(DateValue.of(2014, 7, 7), TimeValue.of(1, 0));
Example where the assertion verifies that the value in the first Column
of the Row
at end point
of the first Change
is close to a date value with a tolerance of 1 hour :
assertThat(changes).change().rowAtEndPoint().value().isCloseTo(DateValue.of(2014, 7, 7), TimeValue.of(1, 0));
expected
- The expected date value.tolerance
- The tolerance of the closeness.this
assertion object.AssertionError
- If the value is not close to the date in parameter.AbstractValueAssert.isCloseTo(DateValue, TimeValue)
,
AbstractAssertWithValues.isCloseTo(DateValue, TimeValue)
T isCloseTo(DateValue expected, DateTimeValue tolerance)
Example where the assertion verifies that the value in the first Column
of the first Row
of the
Table
is close to a date value with a tolerance of 2 days and 1 hour :
assertThat(table).row().value().isCloseTo(DateValue.of(2014, 7, 7),
DateTimeValue.of(DateValue.of(0, 0, 2), TimeValue.of(1, 0)));
Example where the assertion verifies that the value in the first Column
of the Row
at end point
of the first Change
is close to a date value with a tolerance of 2 days and 1 hour :
assertThat(changes).change().rowAtEndPoint().value().isCloseTo(DateValue.of(2014, 7, 7),
DateTimeValue.of(DateValue.of(0, 0, 2), TimeValue.of(1, 0)));
expected
- The expected date value.tolerance
- The tolerance of the closeness.this
assertion object.AssertionError
- If the value is not close to the date in parameter.AbstractValueAssert.isCloseTo(DateValue, DateTimeValue)
,
AbstractAssertWithValues.isCloseTo(DateValue, DateTimeValue)
T isCloseTo(TimeValue expected, TimeValue tolerance)
Example where the assertion verifies that the value in the first Column
of the first Row
of the
Table
is close to a time value with a tolerance of 1 hour :
assertThat(table).row().value().isCloseTo(TimeValue.of(21, 29, 30), TimeValue.of(1, 0));
Example where the assertion verifies that the value in the first Column
of the Row
at end point
of the first Change
is close to a time value with a tolerance of 1 hour :
assertThat(changes).change().rowAtEndPoint().value().isCloseTo(TimeValue.of(21, 29, 30), TimeValue.of(1, 0));
expected
- The expected time value.tolerance
- The tolerance of the closeness.this
assertion object.AssertionError
- If the value is not close to the time in parameter.AbstractValueAssert.isCloseTo(TimeValue, TimeValue)
,
AbstractAssertWithValues.isCloseTo(TimeValue, TimeValue)
T isCloseTo(DateTimeValue expected, DateValue tolerance)
Example where the assertion verifies that the value in the first Column
of the first Row
of the
Table
is close to a date/time value with a tolerance of 2 days :
assertThat(table).row().value().isCloseTo(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
DateValue.of(0, 0, 2));
Example where the assertion verifies that the value in the first Column
of the Row
at end point
of the first Change
is close to a date/time value with a tolerance of 2 days :
assertThat(changes).change().rowAtEndPoint().value().isCloseTo(
DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
DateValue.of(0, 0, 2));
expected
- The expected date/time value.tolerance
- The tolerance of the closeness.this
assertion object.AssertionError
- If the value is not close to the date/time in parameter.AbstractValueAssert.isCloseTo(DateTimeValue, DateValue)
,
AbstractAssertWithValues.isCloseTo(DateTimeValue, DateValue)
T isCloseTo(DateTimeValue expected, TimeValue tolerance)
Example where the assertion verifies that the value in the first Column
of the first Row
of the
Table
is close to a date/time value with a tolerance of 1 hour :
assertThat(table).row().value().isCloseTo(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
TimeValue.of(1, 0));
Example where the assertion verifies that the value in the first Column
of the Row
at end point
of the first Change
is close to a date/time value with a tolerance of 1 hour :
assertThat(changes).change().rowAtEndPoint().value().isCloseTo(
DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
TimeValue.of(1, 0));
expected
- The expected date/time value.tolerance
- The tolerance of the closeness.this
assertion object.AssertionError
- If the value is not close to the date/time in parameter.AbstractValueAssert.isCloseTo(DateTimeValue, TimeValue)
,
AbstractAssertWithValues.isCloseTo(DateTimeValue, TimeValue)
T isCloseTo(DateTimeValue expected, DateTimeValue tolerance)
Example where the assertion verifies that the value in the first Column
of the first Row
of the
Table
is close to a date/time value with a tolerance of 2 days and 1 hour :
assertThat(table).row().value().isCloseTo(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
DateTimeValue.of(DateValue.of(0, 0, 2), TimeValue.of(1, 0)));
Example where the assertion verifies that the value in the first Column
of the Row
at end point
of the first Change
is close to a date/time value with a tolerance of 2 days and 1 hour :
assertThat(changes).change().rowAtEndPoint().value().isCloseTo(
DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29, 30)),
DateTimeValue.of(DateValue.of(0, 0, 2), TimeValue.of(1, 0)));
expected
- The expected date/time value.tolerance
- The tolerance of the closeness.this
assertion object.AssertionError
- If the value is not close to the date/time in parameter.AbstractValueAssert.isCloseTo(DateTimeValue, DateTimeValue)
,
AbstractAssertWithValues.isCloseTo(DateTimeValue, DateTimeValue)
Copyright © 2020 AssertJ. All rights reserved.