提交 7e67a879 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Inline some assert* methods to reduce length of stack traces

上级 4fe88699
...@@ -716,11 +716,7 @@ public abstract class TestBase { ...@@ -716,11 +716,7 @@ public abstract class TestBase {
* @throws AssertionError if the values are not equal * @throws AssertionError if the values are not equal
*/ */
public void assertEquals(Object expected, Object actual) { public void assertEquals(Object expected, Object actual) {
if (expected == null || actual == null) { if (!Objects.equals(expected, actual)) {
assertTrue(expected == actual);
return;
}
if (!expected.equals(actual)) {
fail(" expected: " + expected + " actual: " + actual); fail(" expected: " + expected + " actual: " + actual);
} }
} }
...@@ -961,7 +957,9 @@ public abstract class TestBase { ...@@ -961,7 +957,9 @@ public abstract class TestBase {
* @throws AssertionError if the condition is false * @throws AssertionError if the condition is false
*/ */
public void assertTrue(boolean condition) { public void assertTrue(boolean condition) {
assertTrue("Expected: true got: false", condition); if (!condition) {
fail("Expected: true got: false");
}
} }
/** /**
...@@ -996,7 +994,9 @@ public abstract class TestBase { ...@@ -996,7 +994,9 @@ public abstract class TestBase {
* @throws AssertionError if the condition is true * @throws AssertionError if the condition is true
*/ */
protected void assertFalse(boolean value) { protected void assertFalse(boolean value) {
assertFalse("Expected: false got: true", value); if (value) {
fail("Expected: false got: true");
}
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论