diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java index e4271f0407f52..ada8a9cdb2917 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java @@ -334,9 +334,8 @@ public static void assertExceptionContains(String expectedText, if (msg == null) { throw new AssertionError(E_NULL_THROWABLE_STRING, t); } - if (expectedText != null && !msg.contains(expectedText)) { - String prefix = org.apache.commons.lang3.StringUtils.isEmpty(message) - ? "" : (message + ": "); + if (expectedText != null && !msg.toLowerCase().contains(expectedText.toLowerCase())) { + final String prefix = message == null || message.isEmpty() ? "" : message + ": "; throw new AssertionError( String.format("%s Expected to find '%s' %s: %s", prefix, expectedText, E_UNEXPECTED_EXCEPTION,