public class DifferenceTestDoubleValueMatcher extends java.lang.Object implements ValueMatcher
ValueMatcher
which compares doubles using a difference test
with a tolerance. Difference tests are applicable when the range of
values are known a priori. The basic idea is that the
difference expect - actual
will be within 0 +/- tolerance
when the values are close enough.
Use RatioTestDoubleValueMatcher
, for a more general double comparison technique.
Constructor and Description |
---|
DifferenceTestDoubleValueMatcher(double expected,
double tolerance) |
public DifferenceTestDoubleValueMatcher(double expected, double tolerance)
public boolean matches(java.lang.Object actual)
ValueMatcher
matches
in interface ValueMatcher
public com.google.gson.JsonElement describe(com.google.gson.Gson gson)
ValueMatcher
describe
in interface ValueMatcher