@@ -94,50 +94,6 @@ public void isEqualTo(Object expected) {
94
94
}
95
95
}
96
96
97
- /**
98
- * A check that the actual array and {@code expected} are arrays of the same length and type,
99
- * containing elements such that each element in {@code expected} is within {@code tolerance} of
100
- * each element in the subject, and in the same position.
101
- *
102
- * <p>Behaviour for non-finite values ({@link Double#POSITIVE_INFINITY POSITIVE_INFINITY}, {@link
103
- * Double#NEGATIVE_INFINITY NEGATIVE_INFINITY}, and {@link Double#NaN NaN}) is as follows: If the
104
- * subject and the object of the assertion are the same array, the test will pass. If not
105
- * (including if one is a clone of the other) then non-finite values are considered not equal so
106
- * the any non-finite value in either argument will cause the test to fail.
107
- *
108
- * @deprecated use {@code usingTolerance(someTolerance).containsExactly(someValues).inOrder()},
109
- * noting the different behaviour for non-finite values
110
- */
111
- @ Deprecated
112
- public void isEqualTo (Object expected , double tolerance ) {
113
- double [] actual = actual ();
114
- if (actual == expected ) {
115
- return ; // short-cut.
116
- }
117
- try {
118
- double [] expectedArray = (double []) expected ;
119
- if (expectedArray .length != actual .length ) {
120
- failWithRawMessage (
121
- "Arrays are of different lengths. expected: %s, actual %s" ,
122
- doubleArrayAsString (expectedArray ), doubleArrayAsString (actual ));
123
- return ;
124
- }
125
- List <Integer > unequalIndices = new ArrayList <>();
126
- for (int i = 0 ; i < expectedArray .length ; i ++) {
127
- if (!equalWithinTolerance (actual [i ], expectedArray [i ], tolerance )) {
128
- unequalIndices .add (i );
129
- }
130
- }
131
-
132
- if (!unequalIndices .isEmpty ()) {
133
- fail ("is equal to" , doubleArrayAsString (expectedArray ));
134
- return ;
135
- }
136
- } catch (ClassCastException e ) {
137
- failWithBadType (expected );
138
- }
139
- }
140
-
141
97
/**
142
98
* A check that the actual array and {@code expected} are not arrays of the same length and type,
143
99
* containing elements such that each element in {@code expected} is equal to each element in the
@@ -166,49 +122,6 @@ public void isNotEqualTo(Object expected) {
166
122
}
167
123
}
168
124
169
- /**
170
- * A check that the actual array and {@code expected} are not arrays of the same length and type,
171
- * containing elements such that each element in {@code expected} is within {@code tolerance} of
172
- * each element in the subject, and in the same position.
173
- *
174
- * <p>Behaviour for non-finite values ({@link Double#POSITIVE_INFINITY POSITIVE_INFINITY}, {@link
175
- * Double#NEGATIVE_INFINITY NEGATIVE_INFINITY}, and {@link Double#NaN NaN}) is as follows: If the
176
- * subject and the object of the assertion are the same array, the test will fail. If not
177
- * (including if one is a clone of the other) then non-finite values are considered not equal so
178
- * the any non-finite value in either argument will cause the test to pass.
179
- *
180
- * @deprecated Write a for loop over the values looking for mismatches (see this implementation
181
- * for an example)
182
- */
183
- @ Deprecated
184
- public void isNotEqualTo (Object expectedArray , double tolerance ) {
185
- double [] actual = actual ();
186
- try {
187
- double [] expected = (double []) expectedArray ;
188
- if (actual == expected ) {
189
- failWithRawMessage (
190
- "%s unexpectedly equal to %s." , actualAsString (), doubleArrayAsString (expected ));
191
- return ;
192
- }
193
- if (expected .length != actual .length ) {
194
- return ; // Unequal-lengthed arrays are not equal.
195
- }
196
- List <Integer > unequalIndices = new ArrayList <>();
197
- for (int i = 0 ; i < expected .length ; i ++) {
198
- if (!equalWithinTolerance (actual [i ], expected [i ], tolerance )) {
199
- unequalIndices .add (i );
200
- }
201
- }
202
- if (unequalIndices .isEmpty ()) {
203
- failWithRawMessage (
204
- "%s unexpectedly equal to %s." , actualAsString (), doubleArrayAsString (expected ));
205
- return ;
206
- }
207
- } catch (ClassCastException ignored ) {
208
- // Unequal since they are of different types.
209
- }
210
- }
211
-
212
125
/**
213
126
* A partially specified check about an approximate relationship to a {@code double[]} subject
214
127
* using a tolerance.
0 commit comments