Permalink
Browse files

Issue #473 Implemented suggestions by kcooney

Issue #473 Implemented suggestions by kcooney and added consistent code
formatting.
  • Loading branch information...
1 parent a01caef commit dde798f89fbd1295bf7345ccfab17242ae9d01c0 Arjan Wulder committed Sep 6, 2012
Showing with 381 additions and 45 deletions.
  1. +28 −26 src/main/java/junit/framework/Assert.java
  2. +353 −19 src/main/java/junit/framework/TestCase.java
@@ -2,8 +2,10 @@
/**
* A set of assert methods. Messages are only displayed when an assert fails.
+ *
+ * @deprecated Please use {@link org.junit.Assert} instead.
*/
-
+@Deprecated
public class Assert {
/**
* Protect constructor since it is a static only class
@@ -71,7 +73,7 @@ static public void assertEquals(String message, Object expected, Object actual)
* an AssertionFailedError is thrown.
*/
static public void assertEquals(Object expected, Object actual) {
- assertEquals(null, expected, actual);
+ assertEquals(null, expected, actual);
}
/**
* Asserts that two Strings are equal.
@@ -88,7 +90,7 @@ static public void assertEquals(String message, String expected, String actual)
* Asserts that two Strings are equal.
*/
static public void assertEquals(String expected, String actual) {
- assertEquals(null, expected, actual);
+ assertEquals(null, expected, actual);
}
/**
* Asserts that two doubles are equal concerning a delta. If they are not
@@ -106,7 +108,7 @@ static public void assertEquals(String message, double expected, double actual,
* value is infinity then the delta value is ignored.
*/
static public void assertEquals(double expected, double actual, double delta) {
- assertEquals(null, expected, actual, delta);
+ assertEquals(null, expected, actual, delta);
}
/**
* Asserts that two floats are equal concerning a positive delta. If they
@@ -117,7 +119,7 @@ static public void assertEquals(String message, float expected, float actual, fl
if (Float.compare(expected, actual) == 0)
return;
if (!(Math.abs(expected - actual) <= delta))
- failNotEquals(message, new Float(expected), new Float(actual));
+ failNotEquals(message, new Float(expected), new Float(actual));
}
/**
* Asserts that two floats are equal concerning a delta. If the expected
@@ -131,36 +133,36 @@ static public void assertEquals(float expected, float actual, float delta) {
* an AssertionFailedError is thrown with the given message.
*/
static public void assertEquals(String message, long expected, long actual) {
- assertEquals(message, new Long(expected), new Long(actual));
+ assertEquals(message, new Long(expected), new Long(actual));
}
/**
* Asserts that two longs are equal.
*/
static public void assertEquals(long expected, long actual) {
- assertEquals(null, expected, actual);
+ assertEquals(null, expected, actual);
}
/**
* Asserts that two booleans are equal. If they are not
* an AssertionFailedError is thrown with the given message.
*/
static public void assertEquals(String message, boolean expected, boolean actual) {
- assertEquals(message, Boolean.valueOf(expected), Boolean.valueOf(actual));
- }
+ assertEquals(message, Boolean.valueOf(expected), Boolean.valueOf(actual));
+ }
/**
* Asserts that two booleans are equal.
- */
+ */
static public void assertEquals(boolean expected, boolean actual) {
assertEquals(null, expected, actual);
}
/**
* Asserts that two bytes are equal. If they are not
* an AssertionFailedError is thrown with the given message.
*/
- static public void assertEquals(String message, byte expected, byte actual) {
+ static public void assertEquals(String message, byte expected, byte actual) {
assertEquals(message, new Byte(expected), new Byte(actual));
}
/**
- * Asserts that two bytes are equal.
+ * Asserts that two bytes are equal.
*/
static public void assertEquals(byte expected, byte actual) {
assertEquals(null, expected, actual);
@@ -169,23 +171,23 @@ static public void assertEquals(byte expected, byte actual) {
* Asserts that two chars are equal. If they are not
* an AssertionFailedError is thrown with the given message.
*/
- static public void assertEquals(String message, char expected, char actual) {
- assertEquals(message, new Character(expected), new Character(actual));
- }
+ static public void assertEquals(String message, char expected, char actual) {
+ assertEquals(message, new Character(expected), new Character(actual));
+ }
/**
* Asserts that two chars are equal.
*/
- static public void assertEquals(char expected, char actual) {
+ static public void assertEquals(char expected, char actual) {
assertEquals(null, expected, actual);
}
/**
* Asserts that two shorts are equal. If they are not
* an AssertionFailedError is thrown with the given message.
*/
static public void assertEquals(String message, short expected, short actual) {
- assertEquals(message, new Short(expected), new Short(actual));
+ assertEquals(message, new Short(expected), new Short(actual));
}
- /**
+ /**
* Asserts that two shorts are equal.
*/
static public void assertEquals(short expected, short actual) {
@@ -195,14 +197,14 @@ static public void assertEquals(short expected, short actual) {
* Asserts that two ints are equal. If they are not
* an AssertionFailedError is thrown with the given message.
*/
- static public void assertEquals(String message, int expected, int actual) {
+ static public void assertEquals(String message, int expected, int actual) {
assertEquals(message, new Integer(expected), new Integer(actual));
- }
- /**
- * Asserts that two ints are equal.
+ }
+ /**
+ * Asserts that two ints are equal.
*/
- static public void assertEquals(int expected, int actual) {
- assertEquals(null, expected, actual);
+ static public void assertEquals(int expected, int actual) {
+ assertEquals(null, expected, actual);
}
/**
* Asserts that an object isn't null.
@@ -221,7 +223,7 @@ static public void assertNotNull(String message, Object object) {
* Asserts that an object is null. If it isn't an {@link AssertionError} is
* thrown.
* Message contains: Expected: <null> but was: object
- *
+ *
* @param object
* Object to check or <code>null</code>
*/
@@ -250,7 +252,7 @@ static public void assertSame(String message, Object expected, Object actual) {
* the same an AssertionFailedError is thrown.
*/
static public void assertSame(Object expected, Object actual) {
- assertSame(null, expected, actual);
+ assertSame(null, expected, actual);
}
/**
* Asserts that two objects do not refer to the same object. If they do
Oops, something went wrong.

0 comments on commit dde798f

Please sign in to comment.