j2meunit.framework
Class Assert

java.lang.Object
  |
  +--j2meunit.framework.Assert
Direct Known Subclasses:
TestCase

public class Assert
extends java.lang.Object

A set of assert methods.


Constructor Summary
Assert()
          Creates a new Assert object.
 
Method Summary
 void assertEquals(long expected, long actual)
          Asserts that two longs are equal.
 void assertEquals(java.lang.Object expected, java.lang.Object actual)
          Asserts that two objects are equal.
 void assertEquals(java.lang.String message, long expected, long actual)
          Asserts that two longs are equal.
 void assertEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
          Asserts that two objects are equal.
 void assertNotNull(java.lang.Object object)
          Asserts that an object isn't null.
 void assertNotNull(java.lang.String message, java.lang.Object object)
          Asserts that an object isn't null.
 void assertNull(java.lang.Object object)
          Asserts that an object is null.
 void assertNull(java.lang.String message, java.lang.Object object)
          Asserts that an object is null.
 void assertSame(java.lang.Object expected, java.lang.Object actual)
          Asserts that two objects refer to the same object.
 void assertSame(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
          Asserts that two objects refer to the same object.
 void assertTrue(boolean condition)
          Asserts that a condition is true.
 void assertTrue(java.lang.String message, boolean condition)
          Asserts that a condition is true.
 void fail()
          Fails a test with no message.
 void fail(java.lang.String message)
          Fails a test with the given error message.
protected  void failNotEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
          Fails an "assertEquals" test with the given error message.
protected  void failNotSame(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
          Fails an "assertSame" test with the given error message.
protected  void onAssertion()
          This method is called every time an assertion is made (this does not include direct fails).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Assert

public Assert()
Creates a new Assert object.

Method Detail

assertEquals

public void assertEquals(long expected,
                         long actual)
Asserts that two longs are equal.

Parameters:
expected - the expected value of an object
actual - the actual value of an object

assertEquals

public void assertEquals(java.lang.Object expected,
                         java.lang.Object actual)
Asserts that two objects are equal. If they are not an AssertionFailedError is thrown.

Parameters:
expected - the expected value of an object
actual - the actual value of an object

assertEquals

public void assertEquals(java.lang.String message,
                         long expected,
                         long actual)
Asserts that two longs are equal.

Parameters:
message - the detail message for this assertion
expected - the expected value of an object
actual - the actual value of an object

assertEquals

public void assertEquals(java.lang.String message,
                         java.lang.Object expected,
                         java.lang.Object actual)
Asserts that two objects are equal. If they are not an AssertionFailedError is thrown.

Parameters:
message - The detail message for this assertion
expected - The expected value of an object
actual - The actual value of an object

assertNotNull

public void assertNotNull(java.lang.Object object)
Asserts that an object isn't null.

Parameters:
object - The object to test

assertNotNull

public void assertNotNull(java.lang.String message,
                          java.lang.Object object)
Asserts that an object isn't null.

Parameters:
message - The detail message for this assertion
object - The object to test

assertNull

public void assertNull(java.lang.Object object)
Asserts that an object is null.

Parameters:
object - The object to test

assertNull

public void assertNull(java.lang.String message,
                       java.lang.Object object)
Asserts that an object is null.

Parameters:
message - The detail message for this assertion
object - The object to test

assertSame

public void assertSame(java.lang.Object expected,
                       java.lang.Object actual)
Asserts that two objects refer to the same object. If they are not the same an AssertionFailedError is thrown.

Parameters:
expected - The expected value of an object
actual - The actual value of an object

assertSame

public void assertSame(java.lang.String message,
                       java.lang.Object expected,
                       java.lang.Object actual)
Asserts that two objects refer to the same object. If they are not an AssertionFailedError is thrown.

Parameters:
message - The detail message for this assertion
expected - The expected value of an object
actual - The actual value of an object

assertTrue

public void assertTrue(java.lang.String message,
                       boolean condition)
Asserts that a condition is true. If it isn't it throws an AssertionFailedError with the given message.

Parameters:
message - The detail message for this assertion
condition - The boolean value to test

assertTrue

public void assertTrue(boolean condition)
Asserts that a condition is true. If it isn't it throws an AssertionFailedError.

Parameters:
condition - The boolean value to test

fail

public void fail()
Fails a test with no message.


fail

public void fail(java.lang.String message)
Fails a test with the given error message.

Parameters:
message - The message to display
Throws:
AssertionFailedError - Containing the error message

failNotEquals

protected void failNotEquals(java.lang.String message,
                             java.lang.Object expected,
                             java.lang.Object actual)
Fails an "assertEquals" test with the given error message.

Parameters:
message - The message to display
expected - The expected value
actual - The actual value

failNotSame

protected void failNotSame(java.lang.String message,
                           java.lang.Object expected,
                           java.lang.Object actual)
Fails an "assertSame" test with the given error message.

Parameters:
message - The message to display
expected - The expected value
actual - The actual value

onAssertion

protected void onAssertion()
This method is called every time an assertion is made (this does not include direct fails).