| java.lang.Object net.sourceforge.groboutils.junit.v1.AssertTestFactory
AssertTestFactory | public class AssertTestFactory (Code) | | A factory that creates test instances for the standard set of assert
methods. The created test instances should have their setName()
method invoked to properly set the name of the test. Alternatively, the
factory instance can have the name set so that all tests will have the
same name.
To support JUnit 3.8 functionality, but remain backwards compatible with
earlier JUnit libraries, the names for the JUnit 3.8 methods will be
allowed, but they will call JUnit 3.7 compatible methods.
As of Dec 8, 2002, the factory can uniquely (per instance) name each
generated test via an index. This can help traceability in identifying
each created test. Alternatively, the user can set the factory's name
before invoking a create method.
author: Matt Albrecht groboclown@users.sourceforge.net version: $Date: 2004/01/09 20:32:26 $ since: July 26, 2002 |
Inner Class :abstract public static class InnerTest extends TestCase | |
Constructor Summary | |
public | AssertTestFactory() Creates a new factory that can generate assertions as independent
test objects. | public | AssertTestFactory(String name) Creates a new factory with a specific name for each generated test,
but will not add an index to each generated test's name. | public | AssertTestFactory(String name, boolean useIndexWithName) Creates a new factory with a specific name for each generated test,
and can optionally add an index to each generated test's name. |
Method Summary | |
public InnerTest | createAssertEquals(String message, Object expected, Object actual) Asserts that two objects are equal. | public InnerTest | createAssertEquals(Object expected, Object actual) Asserts that two objects are equal. | public InnerTest | createAssertEquals(String message, String expected, String actual) Asserts that two objects are equal. | public InnerTest | createAssertEquals(String expected, String actual) Asserts that two objects are equal. | public InnerTest | createAssertEquals(String message, double expected, double actual, double delta) Asserts that two doubles are equal concerning a delta. | public InnerTest | createAssertEquals(double expected, double actual, double delta) Asserts that two doubles are equal concerning a delta. | public InnerTest | createAssertEquals(String message, float expected, float actual, float delta) Asserts that two floats are equal concerning a delta. | public InnerTest | createAssertEquals(float expected, float actual, float delta) Asserts that two floats are equal concerning a delta. | public InnerTest | createAssertEquals(String message, long expected, long actual) Asserts that two longs are equal. | public InnerTest | createAssertEquals(long expected, long actual) Asserts that two longs are equal. | public InnerTest | createAssertEquals(String message, boolean expected, boolean actual) Asserts that two booleans are equal. | public InnerTest | createAssertEquals(boolean expected, boolean actual) Asserts that two booleans are equal. | public InnerTest | createAssertEquals(String message, byte expected, byte actual) Asserts that two bytes are equal. | public InnerTest | createAssertEquals(byte expected, byte actual) Asserts that two bytes are equal. | public InnerTest | createAssertEquals(String message, char expected, char actual) Asserts that two chars are equal. | public InnerTest | createAssertEquals(char expected, char actual) Asserts that two chars are equal. | public InnerTest | createAssertEquals(String message, short expected, short actual) Asserts that two shorts are equal. | public InnerTest | createAssertEquals(short expected, short actual) Asserts that two shorts are equal. | public InnerTest | createAssertEquals(String message, int expected, int actual) Asserts that two ints are equal. | public InnerTest | createAssertEquals(int expected, int actual) Asserts that two ints are equal. | public InnerTest | createAssertFalse(String message, boolean condition) Asserts that a condition is false. | public InnerTest | createAssertFalse(boolean condition) Asserts that a condition is true. | public InnerTest | createAssertNotNull(String message, Object object) Asserts that an object isn't null. | public InnerTest | createAssertNotNull(Object object) Asserts that an object isn't null. | public InnerTest | createAssertNotSame(String message, Object expected, Object actual) Asserts that two objects refer to the same object. | public InnerTest | createAssertNotSame(Object expected, Object actual) Asserts that two objects refer to the same object. | public InnerTest | createAssertNull(String message, Object object) Asserts that an object is null. | public InnerTest | createAssertNull(Object object) Asserts that an object is null. | public InnerTest | createAssertSame(String message, Object expected, Object actual) Asserts that two objects refer to the same object. | public InnerTest | createAssertSame(Object expected, Object actual) Asserts that two objects refer to the same object. | public InnerTest | createAssertTrue(String message, boolean condition) Asserts that a condition is true. | public InnerTest | createAssertTrue(boolean condition) Asserts that a condition is true. | public InnerTest | createFail(String message) Fails a test with the given message. | public InnerTest | createFail() Fails a test with no message. | public String | getName() Returns the default test name. | public boolean | getUseIndexWithName() Returns whether each generated test will add a unique (for this
instance) index to the test's name. | public void | setName(String name) Sets the default test name. | public void | setUseIndexWithName(boolean useIndexWithName) Sets whether each generated test will add a unique (for this instance)
index to the test's name. |
AssertTestFactory | public AssertTestFactory()(Code) | | Creates a new factory that can generate assertions as independent
test objects.
|
AssertTestFactory | public AssertTestFactory(String name)(Code) | | Creates a new factory with a specific name for each generated test,
but will not add an index to each generated test's name.
Parameters: name - default name shared by all generated assertion tests. |
AssertTestFactory | public AssertTestFactory(String name, boolean useIndexWithName)(Code) | | Creates a new factory with a specific name for each generated test,
and can optionally add an index to each generated test's name.
Parameters: name - default name shared by all generated assertion tests. Parameters: useIndexWithName - true if indecies will be appendedto each generated test's name, or false if theywill use the passed-in name exactly. since: 08-Dec-2002 |
createAssertEquals | public InnerTest createAssertEquals(String message, Object expected, Object actual)(Code) | | Asserts that two objects are equal. If they are not an
AssertionFailedError is thrown.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(Object expected, Object actual)(Code) | | Asserts that two objects are equal. If they are not an
AssertionFailedError is thrown.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(String message, String expected, String actual)(Code) | | Asserts that two objects are equal. If they are not an
AssertionFailedError is thrown.
since: 30-Oct-2002 Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(String expected, String actual)(Code) | | Asserts that two objects are equal. If they are not an
AssertionFailedError is thrown.
since: 30-Oct-2002 Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(String message, double expected, double actual, double delta)(Code) | | Asserts that two doubles are equal concerning a delta. If the expected
value is infinity then the delta value is ignored.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. Parameters: delta - maximum distance between expected and actual such thatthe two values are considered equivalent. Necessary sincefloating-point numbers on computers are approximations of theirequivalent values; that is, storing 1.1 may actually bestored as 1.099999999999. |
createAssertEquals | public InnerTest createAssertEquals(double expected, double actual, double delta)(Code) | | Asserts that two doubles are equal concerning a delta. If the expected
value is infinity then the delta value is ignored.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. Parameters: delta - maximum distance between expected and actual such thatthe two values are considered equivalent. Necessary sincefloating-point numbers on computers are approximations of theirequivalent values; that is, storing 1.1 may actually bestored as 1.099999999999. |
createAssertEquals | public InnerTest createAssertEquals(String message, float expected, float actual, float delta)(Code) | | Asserts that two floats are equal concerning a delta. If the expected
value is infinity then the delta value is ignored.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. Parameters: delta - maximum distance between expected and actual such thatthe two values are considered equivalent. Necessary sincefloating-point numbers on computers are approximations of theirequivalent values; that is, storing 1.1 may actually bestored as 1.099999999999. |
createAssertEquals | public InnerTest createAssertEquals(float expected, float actual, float delta)(Code) | | Asserts that two floats are equal concerning a delta. If the expected
value is infinity then the delta value is ignored.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. Parameters: delta - maximum distance between expected and actual such thatthe two values are considered equivalent. Necessary sincefloating-point numbers on computers are approximations of theirequivalent values; that is, storing 1.1 may actually bestored as 1.099999999999. |
createAssertEquals | public InnerTest createAssertEquals(String message, long expected, long actual)(Code) | | Asserts that two longs are equal.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(long expected, long actual)(Code) | | Asserts that two longs are equal.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(String message, boolean expected, boolean actual)(Code) | | Asserts that two booleans are equal.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(boolean expected, boolean actual)(Code) | | Asserts that two booleans are equal.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(String message, byte expected, byte actual)(Code) | | Asserts that two bytes are equal.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(byte expected, byte actual)(Code) | | Asserts that two bytes are equal.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(String message, char expected, char actual)(Code) | | Asserts that two chars are equal.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(char expected, char actual)(Code) | | Asserts that two chars are equal.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(String message, short expected, short actual)(Code) | | Asserts that two shorts are equal.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(short expected, short actual)(Code) | | Asserts that two shorts are equal.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(String message, int expected, int actual)(Code) | | Asserts that two ints are equal.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertEquals | public InnerTest createAssertEquals(int expected, int actual)(Code) | | Asserts that two ints are equal.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertFalse | public InnerTest createAssertFalse(String message, boolean condition)(Code) | | Asserts that a condition is false. If it isn't it throws an
AssertionFailedError with the given message.
since: 30-Oct-2002 Parameters: message - message that describes what failed if the assertionfails. Parameters: condition - boolean to check for failure |
createAssertFalse | public InnerTest createAssertFalse(boolean condition)(Code) | | Asserts that a condition is true. If it isn't it throws an
AssertionFailedError.
since: 30-Oct-2002 Parameters: condition - boolean to check for failure |
createAssertNotNull | public InnerTest createAssertNotNull(String message, Object object)(Code) | | Asserts that an object isn't null.
Parameters: message - message that describes what failed if the assertionfails. Parameters: object - test object that must not be null. |
createAssertNotNull | public InnerTest createAssertNotNull(Object object)(Code) | | Asserts that an object isn't null.
Parameters: object - test object that must not be null. |
createAssertNotSame | public InnerTest createAssertNotSame(String message, Object expected, Object actual)(Code) | | Asserts that two objects refer to the same object. If they are not an
AssertionFailedError is thrown.
since: 30-Oct-2002 Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to not find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertNotSame | public InnerTest createAssertNotSame(Object expected, Object actual)(Code) | | Asserts that two objects refer to the same object. If they are not the
same an AssertionFailedError is thrown.
since: 30-Oct-2002 Parameters: expected - value that the test expects to not find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertNull | public InnerTest createAssertNull(String message, Object object)(Code) | | Asserts that an object is null.
Parameters: message - message that describes what failed if the assertionfails. Parameters: object - test object that must be null. |
createAssertNull | public InnerTest createAssertNull(Object object)(Code) | | Asserts that an object is null.
Parameters: object - test object that must be null. |
createAssertSame | public InnerTest createAssertSame(String message, Object expected, Object actual)(Code) | | Asserts that two objects refer to the same object. If they are not an
AssertionFailedError is thrown.
Parameters: message - message that describes what failed if the assertionfails. Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertSame | public InnerTest createAssertSame(Object expected, Object actual)(Code) | | Asserts that two objects refer to the same object. If they are not the
same an AssertionFailedError is thrown.
Parameters: expected - value that the test expects to find from the testedcode. Parameters: actual - actual value generated by tested code. |
createAssertTrue | public InnerTest createAssertTrue(String message, boolean condition)(Code) | | Asserts that a condition is true. If it isn't it throws an
AssertionFailedError with the given message.
Parameters: message - message that describes what failed if the assertionfails. Parameters: condition - boolean to check for failure |
createAssertTrue | public InnerTest createAssertTrue(boolean condition)(Code) | | Asserts that a condition is true. If it isn't it throws an
AssertionFailedError.
Parameters: condition - boolean to check for failure |
createFail | public InnerTest createFail(String message)(Code) | | Fails a test with the given message.
Parameters: message - message that describes what failed if the assertionfails. |
createFail | public InnerTest createFail()(Code) | | Fails a test with no message.
|
getName | public String getName()(Code) | | Returns the default test name. If the name has never been set, then
this will return null.
default name shared by all generated assertion tests. |
getUseIndexWithName | public boolean getUseIndexWithName()(Code) | | Returns whether each generated test will add a unique (for this
instance) index to the test's name.
true if an index is appended to the name, orfalse if the test's name is exactly the factory's name. since: 08-Dec-2002 |
setName | public void setName(String name)(Code) | | Sets the default test name. This will not reset the generated index.
Parameters: name - default name shared by all generated assertion tests. |
setUseIndexWithName | public void setUseIndexWithName(boolean useIndexWithName)(Code) | | Sets whether each generated test will add a unique (for this instance)
index to the test's name. Reseting this value will not affect the
index's value.
Parameters: useIndexWithName - true if indecies will be appendedto each generated test's name, or false if theywill use the passed-in name exactly. since: 08-Dec-2002 |
|
|