@CheckReturnValue public class PrimitiveDoubleArraySubject extends AbstractArraySubject<PrimitiveDoubleArraySubject,double[]>
double[]
.
Note: this class deprecates some common methods because the operation of equality and comparison on floating point numbers requires additional specification. Alternative equality tests are provided.
Modifier and Type | Class and Description |
---|---|
class |
PrimitiveDoubleArraySubject.TolerantPrimitiveDoubleArrayComparison
A partially specified proposition about an approximate relationship to a
double[]
subject using a tolerance. |
failureStrategy
Modifier and Type | Method and Description |
---|---|
PrimitiveDoubleArraySubject.TolerantPrimitiveDoubleArrayComparison |
hasValuesNotWithin(double tolerance)
Prepares for a check that the subject and object are arrays either (a) of the different
lengths, or (b) of the same length but where the values at at least one corresponding position
in each array are finite values not within
tolerance of each other, that is
assertThat(actual[i]).isNotWithin(tolerance).of(expected[i]) passes for at least one
i (see the isNotWithin assertion for doubles). |
PrimitiveDoubleArraySubject.TolerantPrimitiveDoubleArrayComparison |
hasValuesWithin(double tolerance)
Prepares for a check that the subject and object are arrays both (a) of the same length, and
(b) where the values at all corresponding positions in each array are finite values within
tolerance of each other, that is
assertThat(actual[i]).isWithin(tolerance).of(expected[i]) passes for all i
(see the isWithin assertion for doubles). |
void |
isEqualTo(Object expected)
Deprecated.
use
#isWithin(double) |
void |
isEqualTo(Object expected,
double tolerance)
Deprecated.
use
hasValuesWithin(double) , noting the different behaviour for non-finite
values |
void |
isNotEqualTo(Object expected)
Deprecated.
use
#isNotWithin(double) |
void |
isNotEqualTo(Object expectedArray,
double tolerance)
Deprecated.
use
hasValuesNotWithin(double) , noting the different behaviour for
non-finite values |
protected List<Double> |
listRepresentation() |
protected String |
underlyingType() |
getDisplaySubject, hasLength, isEmpty, isNotEmpty, named
check, equals, fail, fail, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getSubject, hashCode, internalCustomName, isAnyOf, isIn, isInstanceOf, isNoneOf, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs
protected String underlyingType()
@Deprecated public void isEqualTo(Object expected)
#isWithin(double)
UnsupportedOperationException
.isEqualTo
in class Subject<PrimitiveDoubleArraySubject,double[]>
@Deprecated public void isEqualTo(Object expected, double tolerance)
hasValuesWithin(double)
, noting the different behaviour for non-finite
valuesexpected
is equal to each element
in the subject, and in the same position.
Behaviour for non-finite values (POSITIVE_INFINITY
,
NEGATIVE_INFINITY
, and NaN
) is as follows:
If the subject and the object of the assertion are the same array the test will pass. If not
(including if one is a clone of the other) then non-finite values are considered not equal so
the any non-finite value in either argument will cause the test to fail.
@Deprecated public void isNotEqualTo(Object expected)
#isNotWithin(double)
UnsupportedOperationException
.isNotEqualTo
in class Subject<PrimitiveDoubleArraySubject,double[]>
@Deprecated public void isNotEqualTo(Object expectedArray, double tolerance)
hasValuesNotWithin(double)
, noting the different behaviour for
non-finite valuesBehaviour for non-finite values (POSITIVE_INFINITY
,
NEGATIVE_INFINITY
, and NaN
) is as follows:
If the subject and the object of the assertion are the same array the test will fail. If not
(including if one is a clone of the other) then non-finite values are considered not equal so
the any non-finite value in either argument will cause the test to pass.
public PrimitiveDoubleArraySubject.TolerantPrimitiveDoubleArrayComparison hasValuesWithin(double tolerance)
tolerance
of each other, that is
assertThat(actual[i]).isWithin(tolerance).of(expected[i])
passes for all i
(see the isWithin
assertion for doubles).
The check will fail if any value in either the subject array or the object array is
Double.POSITIVE_INFINITY
, Double.NEGATIVE_INFINITY
, or Double.NaN
.
tolerance
- an inclusive upper bound on the difference between the subject and object
allowed by the check, which must be a non-negative finite value, i.e. not
Double.NaN
, Double.POSITIVE_INFINITY
, or negative, including -0.0
public PrimitiveDoubleArraySubject.TolerantPrimitiveDoubleArrayComparison hasValuesNotWithin(double tolerance)
tolerance
of each other, that is
assertThat(actual[i]).isNotWithin(tolerance).of(expected[i])
passes for at least one
i
(see the isNotWithin
assertion for doubles).
In the case (b), a pair of subject and object values will not cause the test to pass if
either of them is Double.POSITIVE_INFINITY
, Double.NEGATIVE_INFINITY
, or
Double.NaN
.
tolerance
- an exclusive lower bound on the difference between the subject and object
allowed by the check, which must be a non-negative finite value, i.e. not
Double.NaN
, Double.POSITIVE_INFINITY
, or negative, including -0.0
Copyright © 2015. All Rights Reserved.