Permalink
Browse files

A small performance issue in "assertNull": the line 229

 (We have found several tests that run slow because these strings are appended unnecessarily for null values.)
  • Loading branch information...
1 parent 3639784 commit efa11a4fb62f612347dbf2476afb9b2b54d590c1 @songlh committed Apr 6, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/main/java/junit/framework/Assert.java
@@ -226,7 +226,7 @@ static public void assertNotNull(String message, Object object) {
* Object to check or <code>null</code>
*/
static public void assertNull(Object object) {
- String message = "Expected: <null> but was: " + String.valueOf(object);
+ String message = object != null ? "Expected: <null> but was: " + object.toString() : "";
assertNull(message, object);
}
/**

0 comments on commit efa11a4

Please sign in to comment.