@CheckReturnValue public class PrimitiveFloatArraySubject extends AbstractArraySubject<PrimitiveFloatArraySubject,float[]>
float[]
.
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 |
PrimitiveFloatArraySubject.TolerantPrimitiveFloatArrayComparison
A partially specified proposition about an approximate relationship to a
float[]
subject using a tolerance. |
failureStrategy
Modifier and Type | Method and Description |
---|---|
PrimitiveFloatArraySubject.TolerantPrimitiveFloatArrayComparison |
hasValuesNotWithin(float 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 floats). |
PrimitiveFloatArraySubject.TolerantPrimitiveFloatArrayComparison |
hasValuesWithin(float 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 floats). |
void |
isEqualTo(Object expected)
Deprecated.
use
#isWithin(float) |
void |
isEqualTo(Object expected,
float tolerance)
Deprecated.
use
hasValuesWithin(float) , noting the different behaviour for non-finite
values |
void |
isNotEqualTo(Object expected)
Deprecated.
use
#isNotWithin(float) |
void |
isNotEqualTo(Object expectedArray,
float tolerance)
Deprecated.
use
hasValuesNotWithin(float) , noting the different behaviour for
non-finite values |
protected List<Float> |
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(float)
UnsupportedOperationException
.isEqualTo
in class Subject<PrimitiveFloatArraySubject,float[]>
@Deprecated public void isEqualTo(Object expected, float tolerance)
hasValuesWithin(float)
, 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(float)
UnsupportedOperationException
.isNotEqualTo
in class Subject<PrimitiveFloatArraySubject,float[]>
@Deprecated public void isNotEqualTo(Object expectedArray, float tolerance)
hasValuesNotWithin(float)
, 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 PrimitiveFloatArraySubject.TolerantPrimitiveFloatArrayComparison hasValuesWithin(float tolerance)
tolerance
of each other, that is
assertThat(actual[i]).isWithin(tolerance).of(expected[i])
passes for all i
(see the isWithin
assertion for floats).
The check will fail if any value in either the subject array or the object array is
Float.POSITIVE_INFINITY
, Float.NEGATIVE_INFINITY
, or Float.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
Float.NaN
, Float.POSITIVE_INFINITY
, or negative, including -0.0f
public PrimitiveFloatArraySubject.TolerantPrimitiveFloatArrayComparison hasValuesNotWithin(float 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 floats).
In the case (b), a pair of subject and object values will not cause the test to pass if
either of them is Float.POSITIVE_INFINITY
, Float.NEGATIVE_INFINITY
, or
Float.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
Float.NaN
, Float.POSITIVE_INFINITY
, or negative, including -0.0f
Copyright © 2015. All Rights Reserved.