File tree 1 file changed +6
-1
lines changed
src/main/java/org/junit/internal
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
1
package org .junit .internal ;
2
2
3
3
import java .lang .reflect .Array ;
4
+ import java .util .Arrays ;
4
5
5
6
import org .junit .Assert ;
6
7
@@ -24,7 +25,11 @@ public abstract class ComparisonCriteria {
24
25
*/
25
26
public void arrayEquals (String message , Object expecteds , Object actuals )
26
27
throws ArrayComparisonFailure {
27
- if (expecteds == actuals ) {
28
+ if (expecteds == actuals
29
+ || Arrays .deepEquals (new Object [] {expecteds }, new Object [] {actuals })) {
30
+ // The reflection-based loop below is potentially very slow, especially for primitive
31
+ // arrays. The deepEquals check allows us to circumvent it in the usual case where
32
+ // the arrays are exactly equal.
28
33
return ;
29
34
}
30
35
String header = message == null ? "" : message + ": " ;
You can’t perform that action at this time.
0 commit comments