Skip to content

Commit e83e138

Browse files
committed
8326389: [test] improve assertEquals failure output
Backport-of: 9b1f1e5294e130ec444b08af1f73d08e86fd91ee
1 parent d99ca4d commit e83e138

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

test/lib/jdk/test/lib/Asserts.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,7 @@ public static void assertEquals(Object lhs, Object rhs) {
201201
*/
202202
public static void assertEquals(Object lhs, Object rhs, String msg) {
203203
if ((lhs != rhs) && ((lhs == null) || !(lhs.equals(rhs)))) {
204-
msg = Objects.toString(msg, "assertEquals")
205-
+ ": expected " + Objects.toString(lhs)
206-
+ " to equal " + Objects.toString(rhs);
207-
fail(msg);
204+
fail((msg == null ? "assertEquals" : msg) + " expected: " + lhs + " but was: " + rhs);
208205
}
209206
}
210207

0 commit comments

Comments
 (0)