final class IntegerIsCloseTo extends BaseIsCloseTo<Integer>
Useful to match time values where you want to accept some delta.
Adapted from org.hamcrest.number.IsCloseTo for use with int values.
| Modifier | Constructor and Description |
|---|---|
private |
IntegerIsCloseTo(int value,
int error)
Dedicated constructor.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) long |
actualDelta(Integer item)
Calculates the actual delta.
|
static Matcher<Integer> |
closeTo(int operand,
int error)
Creates a matcher of
Integers that matches when an examined intFF
is equal to the specified operand, within a range of +/-
error. |
describeMismatchSafely, describeTo, error, matched, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringprivate IntegerIsCloseTo(int value,
int error)
Use closeTo(int, int) to create new instances.
value - matched valueerror - accepted deltalong actualDelta(Integer item)
BaseIsCloseToactualDelta in class BaseIsCloseTo<Integer>item - any longpublic static Matcher<Integer> closeTo(int operand, int error)
Integers that matches when an examined intFF
is equal to the specified operand, within a range of +/-
error.
For example:
assertThat(103, is(closeTo(100, 3)))
operand - the expected value of matching doubleserror - the delta (+/-) within which matches will be allowednullCopyright © 2014 Sven Strittmatter. All Rights Reserved.