public class IsCloseTo extends TypeSafeMatcher<java.lang.Double>
| Constructor and Description |
|---|
IsCloseTo(double value,
double error) |
| Modifier and Type | Method and Description |
|---|---|
static Matcher<java.lang.Double> |
closeTo(double operand,
double error)
Creates a matcher of
Doubles that matches when an examined double is equal
to the specified operand, within a range of +/- error. |
void |
describeMismatchSafely(java.lang.Double item,
Description mismatchDescription)
Subclasses should override this.
|
void |
describeTo(Description description)
Generates a description of the object.
|
boolean |
matchesSafely(java.lang.Double item)
Subclasses should implement this.
|
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringpublic boolean matchesSafely(java.lang.Double item)
TypeSafeMatchermatchesSafely in class TypeSafeMatcher<java.lang.Double>public void describeMismatchSafely(java.lang.Double item,
Description mismatchDescription)
TypeSafeMatcherdescribeMismatchSafely in class TypeSafeMatcher<java.lang.Double>public void describeTo(Description description)
SelfDescribingdescription - The description to be built or appended to.public static Matcher<java.lang.Double> closeTo(double operand, double error)
Doubles that matches when an examined double is equal
to the specified operand, within a range of +/- error.
For example:
assertThat(1.03, is(closeTo(1.0, 0.03)))
operand - the expected value of matching doubleserror - the delta (+/-) within which matches will be allowed