HADOOP-14415. Use java.lang.AssertionError instead of junit.framework.AssertionFailedError. Contributed by Chen Liang.

This commit is contained in:
Akira Ajisaka 2017-05-17 15:38:28 -04:00
parent 035d46836b
commit d4aa9e3c69
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
3 changed files with 6 additions and 10 deletions

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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);
}
}