|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jcoderz.commons.util.Assert
public final class Assert
Utility class for assertions.
| Method Summary | |
|---|---|
static void |
assertEquals(String message,
int expected,
int actual)
Asserts that two integers are equal. |
static void |
assertEquals(String message,
Object expected,
Object actual)
Asserts that two objects are equal. |
static void |
assertTrue(String message,
boolean condition)
Asserts that a condition is true. |
static void |
fail(String message)
Can be called if an assertion already failed. |
static void |
fail(String message,
Throwable ex)
Can be called if an exception is unexpectedly caught. |
static void |
notNull(Object parameter,
String argumentName)
Asserts that an object isn't null. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void notNull(Object parameter,
String argumentName)
parameter - object to be tested against null.argumentName - name of the provided argument within the
used interface.
public static void assertEquals(String message,
int expected,
int actual)
throws AssertionFailedException
message - The message for the condition. This message is
used in the exception if the integers are not equal.expected - the expected integer.actual - the actual integer.
AssertionFailedException - if the two objects are not equal.
public static void assertEquals(String message,
Object expected,
Object actual)
throws AssertionFailedException
message - The message for the condition. This message is
used in the exception if the objects are not equal.expected - the expected object.actual - the actual object.
AssertionFailedException - if the two objects are not equal.
public static void assertTrue(String message,
boolean condition)
throws AssertionFailedException
message - The message for the condition. This message is
used in the exception if the condition is false.condition - the condition to test.
AssertionFailedException - if the condition is false.
public static void fail(String message)
throws AssertionFailedException
message - The message to be used in the exception.
AssertionFailedException - always.
public static void fail(String message,
Throwable ex)
throws AssertionFailedException
message - The message to be used in the exception.ex - the exception that was not expected
AssertionFailedException - always.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||