Matcher<java.lang.Double>
, SelfDescribing
public class IsCloseTo extends TypeSafeMatcher<java.lang.Double>
Constructor | Description |
---|---|
IsCloseTo(double value,
double error) |
Modifier and Type | Method | Description |
---|---|---|
static Matcher<java.lang.Double> |
closeTo(double operand,
double error) |
Creates a matcher of
Double s 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.
|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
describeMismatch, matches
public boolean matchesSafely(java.lang.Double item)
TypeSafeMatcher
matchesSafely
in class TypeSafeMatcher<java.lang.Double>
public void describeMismatchSafely(java.lang.Double item, Description mismatchDescription)
TypeSafeMatcher
describeMismatchSafely
in class TypeSafeMatcher<java.lang.Double>
public void describeTo(Description description)
SelfDescribing
description
- The description to be built or appended to.public static Matcher<java.lang.Double> closeTo(double operand, double error)
Double
s 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