diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java index 162a9421d3..da93196574 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java @@ -17,7 +17,6 @@ */ package org.apache.hadoop.fs; -import junit.framework.AssertionFailedError; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.shell.Command; import org.apache.hadoop.fs.shell.CommandFactory; @@ -45,7 +44,7 @@ public void testConfWithInvalidFile() throws Throwable { } if (!(th instanceof RuntimeException)) { - throw new AssertionFailedError("Expected Runtime exception, got: " + th) + throw new AssertionError("Expected Runtime exception, got: " + th) .initCause(th); } } diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java index e59ac77982..1375d9b0b9 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java @@ -37,8 +37,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; -import junit.framework.AssertionFailedError; - import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -328,7 +326,7 @@ private void assertWikified(Exception e) throws Throwable { private void assertInException(Exception e, String text) throws Throwable { String message = extractExceptionMessage(e); if (!(message.contains(text))) { - throw new AssertionFailedError("Wrong text in message " + throw new AssertionError("Wrong text in message " + "\"" + message + "\"" + " expected \"" + text + "\"") .initCause(e); @@ -339,7 +337,7 @@ private String extractExceptionMessage(Exception e) throws Throwable { assertNotNull("Null Exception", e); String message = e.getMessage(); if (message == null) { - throw new AssertionFailedError("Empty text in exception " + e) + throw new AssertionError("Empty text in exception " + e) .initCause(e); } return message; @@ -349,7 +347,7 @@ private void assertNotInException(Exception e, String text) throws Throwable{ String message = extractExceptionMessage(e); if (message.contains(text)) { - throw new AssertionFailedError("Wrong text in message " + throw new AssertionError("Wrong text in message " + "\"" + message + "\"" + " did not expect \"" + text + "\"") .initCause(e); @@ -364,7 +362,7 @@ private IOException verifyExceptionClass(IOException e, "localhost", LOCAL_PORT, e); LOG.info(wrapped.toString(), wrapped); if(!(wrapped.getClass().equals(expectedClass))) { - throw new AssertionFailedError("Wrong exception class; expected " + throw new AssertionError("Wrong exception class; expected " + expectedClass + " got " + wrapped.getClass() + ": " + wrapped).initCause(wrapped); } diff --git a/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftFileSystemContract.java b/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftFileSystemContract.java index 46a5f0f637..76716b2e50 100644 --- a/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftFileSystemContract.java +++ b/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftFileSystemContract.java @@ -18,7 +18,6 @@ package org.apache.hadoop.fs.swift; -import junit.framework.AssertionFailedError; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; @@ -119,7 +118,7 @@ public void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception { public void testWriteReadAndDeleteEmptyFile() throws Exception { try { super.testWriteReadAndDeleteEmptyFile(); - } catch (AssertionFailedError e) { + } catch (AssertionError e) { SwiftTestUtils.downgrade("empty files get mistaken for directories", e); } }