Skip to content

Commit

Permalink
[1145] Use the objectsToString() method to covert failure messages to…
Browse files Browse the repository at this point in the history
… a string rather than using toString() on the object array. (#1146)

Signed-off-by: James R. Perkins <jperkins@redhat.com>
  • Loading branch information
jamezp authored Oct 16, 2023
1 parent 1a8e36d commit e5d1b8d
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -715,29 +715,29 @@ protected void clearProperty(Property key) {
assertEquals(T first, T second, Object... message) {
if (first == null && second == null)
return;
assertFalse(first == null && second != null, message.toString());
assertFalse(first != null && second == null, message.toString());
assertFalse(first == null && second != null, objectsToString(message));
assertFalse(first != null && second == null, objectsToString(message));
if (first instanceof Comparable)
assertTrue(((Comparable<T>) first).compareTo(second) == 0, message.toString());
assertTrue(((Comparable<T>) first).compareTo(second) == 0, objectsToString(message));
else
assertTrue(first.equals(second), message.toString());
assertTrue(first.equals(second), objectsToString(message));
}

public static <T> void //
assertEqualsInt(int first, int second, Object... message) {
assertTrue(first == second, message.toString());
assertTrue(first == second, objectsToString(message));
}

public static <T> void //
assertEqualsLong(long first, long second, Object... message)
{
assertTrue(first == second, message.toString());
assertTrue(first == second, objectsToString(message));
}

public static <T> void //
assertEqualsBool(boolean first, boolean second, Object... message)
{
assertTrue(first == second, message.toString());
assertTrue(first == second, objectsToString(message));
}

/**
Expand All @@ -751,7 +751,7 @@ protected void clearProperty(Property key) {
*/
public static void //
assertNull(Object object, Object... message) {
assertTrue(object == null, message.toString());
assertTrue(object == null, objectsToString(message));
}

/**
Expand All @@ -765,7 +765,7 @@ protected void clearProperty(Property key) {
*/
public static void //
assertNotNull(Object object, Object... message) {
assertTrue(object != null, message.toString());
assertTrue(object != null, objectsToString(message));
}

/**
Expand Down Expand Up @@ -795,7 +795,7 @@ public static void fault(Object... objects) throws Fault {
*/
public static void assertContains(String string, String substring,
Object... message) {
assertTrue(string.contains(substring), message.toString());
assertTrue(string.contains(substring), objectsToString(message));
}

/**
Expand All @@ -812,7 +812,7 @@ public static void assertContains(String string, String substring,
*/
public static void assertContainsIgnoreCase(String string, String substring,
Object... message) {
assertTrue(string.toLowerCase().contains(substring.toLowerCase()), message.toString());
assertTrue(string.toLowerCase().contains(substring.toLowerCase()), objectsToString(message));
}

/**
Expand All @@ -828,7 +828,7 @@ public static void assertContainsIgnoreCase(String string, String substring,
*/
public static <T> void assertContains(T text, T subtext, Object... message)
{
assertContains(text.toString(), subtext.toString(), message.toString());
assertContains(text.toString(), subtext.toString(), objectsToString(message));
}

/**
Expand All @@ -845,7 +845,7 @@ public static <T> void assertContains(T text, T subtext, Object... message)
*/
public static <T> void assertContainsIgnoreCase(T text, T subtext,
Object... message) {
assertContainsIgnoreCase(text.toString(), subtext.toString(), message.toString());
assertContainsIgnoreCase(text.toString(), subtext.toString(), objectsToString(message));
}

/**
Expand Down

0 comments on commit e5d1b8d

Please sign in to comment.