CommonsTestingMatchers.closeTo(long, long) instead@Deprecated public class IsCloseTo extends LongIsCloseTo
Useful to match time values where you want to accept some delta.
Adapted from org.hamcrest.number.IsCloseTo for use with long values.
| Constructor and Description |
|---|
IsCloseTo(long value,
long error)
Deprecated.
Dedicated constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static Matcher<Long> |
closeTo(long operand,
long error)
Deprecated.
Creates a matcher of
Doubles that matches when an examined double is equal to the specified
operand, within a range of +/- error. |
actualDeltadescribeMismatchSafely, describeTo, error, matched, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringpublic IsCloseTo(long value,
long error)
value - matched valueerror - accepted deltapublic static Matcher<Long> closeTo(long operand, long error)
Doubles that matches when an examined double is equal to the specified
operand, within a range of +/- error.
For example:
assertThat(103L, is(closeTo(100L, 3L)))
operand - the expected value of matching doubleserror - the delta (+/-) within which matches will be allowednull, always new instanceCopyright © 2014 Sven Strittmatter. All Rights Reserved.