HADOOP-14415. Use java.lang.AssertionError instead of junit.framework.AssertionFailedError. Contributed by Chen Liang.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d4aa9e3c Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d4aa9e3c Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d4aa9e3c Branch: refs/heads/YARN-5734 Commit: d4aa9e3c699f6a584ed020851189a81f825ce915 Parents: 035d468 Author: Akira Ajisaka <[email protected]> Authored: Wed May 17 15:38:28 2017 -0400 Committer: Akira Ajisaka <[email protected]> Committed: Wed May 17 15:38:28 2017 -0400 ---------------------------------------------------------------------- .../src/test/java/org/apache/hadoop/fs/TestFsShell.java | 3 +-- .../src/test/java/org/apache/hadoop/net/TestNetUtils.java | 10 ++++------ .../hadoop/fs/swift/TestSwiftFileSystemContract.java | 3 +-- 3 files changed, 6 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/d4aa9e3c/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFsShell.java ---------------------------------------------------------------------- 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 162a942..da93196 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 class TestFsShell { } if (!(th instanceof RuntimeException)) { - throw new AssertionFailedError("Expected Runtime exception, got: " + th) + throw new AssertionError("Expected Runtime exception, got: " + th) .initCause(th); } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/d4aa9e3c/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java ---------------------------------------------------------------------- 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 e59ac77..1375d9b 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.Enumeration; 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 @@ public class TestNetUtils { 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 @@ public class TestNetUtils { 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 @@ public class TestNetUtils { 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 @@ public class TestNetUtils { "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); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/d4aa9e3c/hadoop-tools/hadoop-openstack/src/test/java/org/apache/hadoop/fs/swift/TestSwiftFileSystemContract.java ---------------------------------------------------------------------- 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 46a5f0f..76716b2 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 class TestSwiftFileSystemContract public void testWriteReadAndDeleteEmptyFile() throws Exception { try { super.testWriteReadAndDeleteEmptyFile(); - } catch (AssertionFailedError e) { + } catch (AssertionError e) { SwiftTestUtils.downgrade("empty files get mistaken for directories", e); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
