From e4a69447087e7bbaf11b8fafa50ddb684a262226 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Fri, 27 Dec 2024 22:25:07 +0100 Subject: [PATCH] Introduce missing `assertEquals(long, Long, String)` overload This reinstates a method that was introduced in 80e02ff41021210415a49c488089f05b1aa3dd12 but accidentally replaced in 89dc5845fcb46c26af187e50ea907a7382d06e72. --- testng-asserts/src/main/java/org/testng/Assert.java | 12 ++++++++++++ .../src/test/java/test/asserttests/AssertTest.java | 1 + 2 files changed, 13 insertions(+) diff --git a/testng-asserts/src/main/java/org/testng/Assert.java b/testng-asserts/src/main/java/org/testng/Assert.java index a5feb57f6..894922354 100644 --- a/testng-asserts/src/main/java/org/testng/Assert.java +++ b/testng-asserts/src/main/java/org/testng/Assert.java @@ -968,6 +968,18 @@ public static void assertEquals(Long actual, long expected, String message) { assertEquals(actual, Long.valueOf(expected), message); } + /** + * Asserts that two longs are equal. If they are not, an AssertionError, with the given message, + * is thrown. + * + * @param actual the actual value + * @param expected the expected value + * @param message the assertion error message + */ + public static void assertEquals(long actual, Long expected, String message) { + assertEquals(Long.valueOf(actual), expected, message); + } + /** * Asserts that two longs are equal. If they are not, an AssertionError, with the given message, * is thrown. diff --git a/testng-asserts/src/test/java/test/asserttests/AssertTest.java b/testng-asserts/src/test/java/test/asserttests/AssertTest.java index c500fa131..c0bb84981 100644 --- a/testng-asserts/src/test/java/test/asserttests/AssertTest.java +++ b/testng-asserts/src/test/java/test/asserttests/AssertTest.java @@ -51,6 +51,7 @@ public void assertEqualsBoxedUnboxedLong() { assertEquals(a, b); assertEquals(a, b, ""); assertEquals(b, a); + assertEquals(b, a, ""); assertEquals(Long.valueOf(b), a, ""); }