|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.progeeks.junit.ContextualTestCase
public abstract class ContextualTestCase
Abstract base class for test cases which use a test context. Takes care of setting up and tearing down the test context using any configured test fixture. Test cases which require test contexts should extend this class and implement their own test methods.
This class also supports the ability to test conditions in test context using the template expression processor to determine the values to test. It provides various assert methods that are analogous to the standard assert methods in junit.framework.Assert.
Nested Class Summary | |
---|---|
static class |
ContextualTestCase.ContextTest
Abstract base class for all of the context test classes. |
static class |
ContextualTestCase.EqualsTest
Context test that checks to see if the value of the template expression is equal to an expected value. |
static class |
ContextualTestCase.FalseTest
Context test that checks to see if the value of the template expression is false. |
static class |
ContextualTestCase.NotNullTest
Context test that checks to see if the value of the template expression is not null. |
static class |
ContextualTestCase.NotSameTest
Context test that checks to see if the value of the template expression is not the same as an expected value. |
static class |
ContextualTestCase.NullTest
Context test that checks to see if the value of the template expression is null. |
static class |
ContextualTestCase.SameTest
Context test that checks to see if the value of the template expression is the same as an expected value. |
static class |
ContextualTestCase.TrueTest
Context test that checks to see if the value of the template expression is true |
Constructor Summary | |
---|---|
ContextualTestCase()
Constructor that does not set the test case name. |
|
ContextualTestCase(java.lang.String name)
Constructor that sets the test case name. |
Method Summary | |
---|---|
static void |
assertEquals(java.lang.Object expected,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is equal to the expected value. |
static void |
assertEquals(java.lang.String message,
java.lang.Object expected,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is equal to the expected value. |
static void |
assertFalse(java.lang.String message,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is false. |
static void |
assertFalse(TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is false. |
static void |
assertNotNull(java.lang.String message,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is not null. |
static void |
assertNotNull(TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is not null. |
static void |
assertNotSame(java.lang.Object expected,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation does not refer to the expected object. |
static void |
assertNotSame(java.lang.String message,
java.lang.Object expected,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation does not refer to the expected object. |
static void |
assertNull(java.lang.String message,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is null. |
static void |
assertNull(TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is null. |
static void |
assertSame(java.lang.Object expected,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation refers to the expected object. |
static void |
assertSame(java.lang.String message,
java.lang.Object expected,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation refers to the expected object. |
static void |
assertTrue(java.lang.String message,
TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is true. |
static void |
assertTrue(TemplateExpressionProcessor.TemplateExpression expression)
Asserts that the value returned by the expression evaluation is true. |
java.util.List |
getContextTests()
Returns the list of context tests to apply after each test method. |
TestContext |
getTestContext()
Returns the test context for the test case. |
BeanConfigurator |
getTestContextFactory()
Returns the context factory for generating test contexts. |
protected void |
runContextTests()
|
protected void |
runTest()
Method invoked to actually run a test method. |
void |
setContextTests(java.util.List contextTests)
Sets the list of context tests to apply after each test method. |
void |
setTestContext(TestContext context)
Set the test context for the test case. |
void |
setTestContextFactory(BeanConfigurator contextFactory)
Sets the context factory for generating test contexts. |
protected void |
setUp()
Sets up for a run of the test case using the test fixture (if one is configured) to initialize the test context. |
protected void |
tearDown()
Cleans up after a run of the test case by using the test fixture (if one is configured) to tear down the test context. |
java.lang.String |
toString()
Override to return more specific description of what case and context this instance is running. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, setName |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ContextualTestCase()
public ContextualTestCase(java.lang.String name)
name
- Test case name.Method Detail |
---|
public void setTestContext(TestContext context)
context
- New test context.public TestContext getTestContext()
public void setTestContextFactory(BeanConfigurator contextFactory)
contextFactory
- New test context factory.public BeanConfigurator getTestContextFactory()
public void setContextTests(java.util.List contextTests)
public java.util.List getContextTests()
protected void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
protected void tearDown() throws java.lang.Exception
tearDown
in class junit.framework.TestCase
java.lang.Exception
protected void runTest() throws java.lang.Throwable
runTest
in class junit.framework.TestCase
java.lang.Throwable
public java.lang.String toString()
toString
in class junit.framework.TestCase
protected void runContextTests()
public static void assertEquals(java.lang.Object expected, TemplateExpressionProcessor.TemplateExpression expression)
public static void assertEquals(java.lang.String message, java.lang.Object expected, TemplateExpressionProcessor.TemplateExpression expression)
public static void assertSame(java.lang.Object expected, TemplateExpressionProcessor.TemplateExpression expression)
public static void assertSame(java.lang.String message, java.lang.Object expected, TemplateExpressionProcessor.TemplateExpression expression)
public static void assertNotSame(java.lang.Object expected, TemplateExpressionProcessor.TemplateExpression expression)
public static void assertNotSame(java.lang.String message, java.lang.Object expected, TemplateExpressionProcessor.TemplateExpression expression)
public static void assertNull(TemplateExpressionProcessor.TemplateExpression expression)
public static void assertNull(java.lang.String message, TemplateExpressionProcessor.TemplateExpression expression)
public static void assertNotNull(TemplateExpressionProcessor.TemplateExpression expression)
public static void assertNotNull(java.lang.String message, TemplateExpressionProcessor.TemplateExpression expression)
public static void assertFalse(TemplateExpressionProcessor.TemplateExpression expression)
public static void assertFalse(java.lang.String message, TemplateExpressionProcessor.TemplateExpression expression)
public static void assertTrue(TemplateExpressionProcessor.TemplateExpression expression)
public static void assertTrue(java.lang.String message, TemplateExpressionProcessor.TemplateExpression expression)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |