|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.groboutils.junit.v1.AssertTestFactory
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.
Nested Class Summary | |
static class |
AssertTestFactory.InnerTest
Inner test instance which specializes in generating a message with the test's instance's specific name. |
Constructor Summary | |
AssertTestFactory()
Creates a new factory that can generate assertions as independent test objects. |
|
AssertTestFactory(java.lang.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. |
|
AssertTestFactory(java.lang.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 | |
AssertTestFactory.InnerTest |
createAssertEquals(boolean expected,
boolean actual)
Asserts that two booleans are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(byte expected,
byte actual)
Asserts that two bytes are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(char expected,
char actual)
Asserts that two chars are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(double expected,
double actual,
double delta)
Asserts that two doubles are equal concerning a delta. |
AssertTestFactory.InnerTest |
createAssertEquals(float expected,
float actual,
float delta)
Asserts that two floats are equal concerning a delta. |
AssertTestFactory.InnerTest |
createAssertEquals(int expected,
int actual)
Asserts that two ints are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(long expected,
long actual)
Asserts that two longs are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.Object expected,
java.lang.Object actual)
Asserts that two objects are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(short expected,
short actual)
Asserts that two shorts are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
boolean expected,
boolean actual)
Asserts that two booleans are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
byte expected,
byte actual)
Asserts that two bytes are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
char expected,
char actual)
Asserts that two chars are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
double expected,
double actual,
double delta)
Asserts that two doubles are equal concerning a delta. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
float expected,
float actual,
float delta)
Asserts that two floats are equal concerning a delta. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
int expected,
int actual)
Asserts that two ints are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
long expected,
long actual)
Asserts that two longs are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
java.lang.Object expected,
java.lang.Object actual)
Asserts that two objects are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
short expected,
short actual)
Asserts that two shorts are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String expected,
java.lang.String actual)
Asserts that two objects are equal. |
AssertTestFactory.InnerTest |
createAssertEquals(java.lang.String message,
java.lang.String expected,
java.lang.String actual)
Asserts that two objects are equal. |
AssertTestFactory.InnerTest |
createAssertFalse(boolean condition)
Asserts that a condition is true. |
AssertTestFactory.InnerTest |
createAssertFalse(java.lang.String message,
boolean condition)
Asserts that a condition is false. |
AssertTestFactory.InnerTest |
createAssertNotNull(java.lang.Object object)
Asserts that an object isn't null. |
AssertTestFactory.InnerTest |
createAssertNotNull(java.lang.String message,
java.lang.Object object)
Asserts that an object isn't null. |
AssertTestFactory.InnerTest |
createAssertNotSame(java.lang.Object expected,
java.lang.Object actual)
Asserts that two objects refer to the same object. |
AssertTestFactory.InnerTest |
createAssertNotSame(java.lang.String message,
java.lang.Object expected,
java.lang.Object actual)
Asserts that two objects refer to the same object. |
AssertTestFactory.InnerTest |
createAssertNull(java.lang.Object object)
Asserts that an object is null. |
AssertTestFactory.InnerTest |
createAssertNull(java.lang.String message,
java.lang.Object object)
Asserts that an object is null. |
AssertTestFactory.InnerTest |
createAssertSame(java.lang.Object expected,
java.lang.Object actual)
Asserts that two objects refer to the same object. |
AssertTestFactory.InnerTest |
createAssertSame(java.lang.String message,
java.lang.Object expected,
java.lang.Object actual)
Asserts that two objects refer to the same object. |
AssertTestFactory.InnerTest |
createAssertTrue(boolean condition)
Asserts that a condition is true. |
AssertTestFactory.InnerTest |
createAssertTrue(java.lang.String message,
boolean condition)
Asserts that a condition is true. |
AssertTestFactory.InnerTest |
createFail()
Fails a test with no message. |
AssertTestFactory.InnerTest |
createFail(java.lang.String message)
Fails a test with the given message. |
java.lang.String |
getName()
Returns the default test name. |
boolean |
getUseIndexWithName()
Returns whether each generated test will add a unique (for this instance) index to the test's name. |
void |
setName(java.lang.String name)
Sets the default test name. |
void |
setUseIndexWithName(boolean useIndexWithName)
Sets whether each generated test will add a unique (for this instance) index to the test's name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AssertTestFactory()
public AssertTestFactory(java.lang.String name)
name
- default name shared by all generated assertion tests.public AssertTestFactory(java.lang.String name, boolean useIndexWithName)
name
- default name shared by all generated assertion tests.useIndexWithName
- true if indecies will be appended
to each generated test's name, or false if they
will use the passed-in name exactly.Method Detail |
public void setName(java.lang.String name)
name
- default name shared by all generated assertion tests.public java.lang.String getName()
public void setUseIndexWithName(boolean useIndexWithName)
useIndexWithName
- true if indecies will be appended
to each generated test's name, or false if they
will use the passed-in name exactly.public boolean getUseIndexWithName()
public AssertTestFactory.InnerTest createAssertTrue(java.lang.String message, boolean condition)
message
- message that describes what failed if the assertion
fails.condition
- boolean to check for failurepublic AssertTestFactory.InnerTest createAssertTrue(boolean condition)
condition
- boolean to check for failurepublic AssertTestFactory.InnerTest createAssertFalse(java.lang.String message, boolean condition)
message
- message that describes what failed if the assertion
fails.condition
- boolean to check for failurepublic AssertTestFactory.InnerTest createAssertFalse(boolean condition)
condition
- boolean to check for failurepublic AssertTestFactory.InnerTest createFail(java.lang.String message)
message
- message that describes what failed if the assertion
fails.public AssertTestFactory.InnerTest createFail()
public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(java.lang.Object expected, java.lang.Object actual)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, java.lang.String expected, java.lang.String actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String expected, java.lang.String actual)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, double expected, double actual, double delta)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.delta
- maximum distance between expected and actual such that
the two values are considered equivalent. Necessary since
floating-point numbers on computers are approximations of their
equivalent values; that is, storing 1.1 may actually be
stored as 1.099999999999.public AssertTestFactory.InnerTest createAssertEquals(double expected, double actual, double delta)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.delta
- maximum distance between expected and actual such that
the two values are considered equivalent. Necessary since
floating-point numbers on computers are approximations of their
equivalent values; that is, storing 1.1 may actually be
stored as 1.099999999999.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, float expected, float actual, float delta)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.delta
- maximum distance between expected and actual such that
the two values are considered equivalent. Necessary since
floating-point numbers on computers are approximations of their
equivalent values; that is, storing 1.1 may actually be
stored as 1.099999999999.public AssertTestFactory.InnerTest createAssertEquals(float expected, float actual, float delta)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.delta
- maximum distance between expected and actual such that
the two values are considered equivalent. Necessary since
floating-point numbers on computers are approximations of their
equivalent values; that is, storing 1.1 may actually be
stored as 1.099999999999.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, long expected, long actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(long expected, long actual)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, boolean expected, boolean actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(boolean expected, boolean actual)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, byte expected, byte actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(byte expected, byte actual)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, char expected, char actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(char expected, char actual)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, short expected, short actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(short expected, short actual)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(java.lang.String message, int expected, int actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertEquals(int expected, int actual)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertNotNull(java.lang.String message, java.lang.Object object)
message
- message that describes what failed if the assertion
fails.object
- test object that must not be null.public AssertTestFactory.InnerTest createAssertNotNull(java.lang.Object object)
object
- test object that must not be null.public AssertTestFactory.InnerTest createAssertNull(java.lang.String message, java.lang.Object object)
message
- message that describes what failed if the assertion
fails.object
- test object that must be null.public AssertTestFactory.InnerTest createAssertNull(java.lang.Object object)
object
- test object that must be null.public AssertTestFactory.InnerTest createAssertSame(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertSame(java.lang.Object expected, java.lang.Object actual)
expected
- value that the test expects to find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertNotSame(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
message
- message that describes what failed if the assertion
fails.expected
- value that the test expects to not find from the tested
code.actual
- actual value generated by tested code.public AssertTestFactory.InnerTest createAssertNotSame(java.lang.Object expected, java.lang.Object actual)
expected
- value that the test expects to not find from the tested
code.actual
- actual value generated by tested code.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |