|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hamcrest.BaseMatcher<T> org.hamcrest.TypeSafeMatcher<java.lang.Double> org.hamcrest.number.IsCloseTo
public class IsCloseTo
Is the value a number equal to a value within some range of acceptable error?
Constructor Summary | |
---|---|
IsCloseTo(double value,
double error)
|
Method Summary | |
---|---|
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. |
Methods inherited from class org.hamcrest.TypeSafeMatcher |
---|
describeMismatch, matches |
Methods inherited from class org.hamcrest.BaseMatcher |
---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IsCloseTo(double value, double error)
Method Detail |
---|
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |