public abstract class AbstractStrategyTestCase
extends junit.framework.TestCase
A base for a strategy tests. A strategy test is different from a traditional JUnit test by allowing more flexibility. Where a traditional JUnit testCase simply offers a
flow, a strategy test supports any setup that can be implemented from a run() method.
Apart from providing strategies, this TestCase also provides a Hub for configuration (this test configures itself by passing this to the hub within a begin/end scope.
Finally, this test also provides an assertThat(actual, expression) method and a Constraint factory reachable via the is attribute.
| Modifier and Type | Field and Description |
|---|---|
protected ConstraintFactory |
is
All expressions for the assertThatMethods are reachable from this factory.
|
| Constructor and Description |
|---|
AbstractStrategyTestCase(String name) |
AbstractStrategyTestCase(String name,
Hub hub)
Takes the name of the test as a parameter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertThat(boolean result,
Expression constraint) |
void |
assertThat(byte result,
Expression constraint) |
void |
assertThat(char result,
Expression constraint) |
void |
assertThat(double result,
Expression constraint) |
void |
assertThat(float result,
Expression constraint) |
void |
assertThat(int result,
Expression constraint) |
void |
assertThat(long result,
Expression constraint) |
void |
assertThat(Object actual,
Expression expression)
Assert method that asserts that the object passed in the actual parameter
passes the constraint passed in the expected parameter.
|
void |
assertThat(short result,
Expression constraint) |
protected abstract TestStep |
createStrategy(String test)
Implement this method to return a strategy to run for the given test.
|
Hub |
getHub() |
StrategyRunner |
getStrategyRunner() |
protected Verifiable |
getVerifiable() |
void |
runBare()
Gets and runs the strategy.
|
void |
setAsserter(Assert asserter) |
void |
setStrategyRunner(StrategyRunner strategyRunner) |
void |
setTestCaseListener(TestCaseListener testCaseListener) |
void |
setVerifiable(Verifiable verifiable) |
countTestCases, createResult, getName, run, run, runTest, setName, setUp, tearDown, toStringassertEquals, 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, failNotEquals, failNotSame, failSame, formatprotected ConstraintFactory is
public AbstractStrategyTestCase(String name)
public void setStrategyRunner(StrategyRunner strategyRunner)
public StrategyRunner getStrategyRunner()
protected abstract TestStep createStrategy(String test)
test - The test to get the strategy forpublic void runBare()
throws Throwable
runBare in class junit.framework.TestCaseThrowablepublic Hub getHub()
public void assertThat(Object actual, Expression expression)
actual - The actual object that is checked against the expected constraint.expression - The constraint that actual is expected to passpublic void assertThat(boolean result,
Expression constraint)
Assert#assertThat(boolean)public void assertThat(byte result,
Expression constraint)
Assert#assertThat(byte)public void assertThat(char result,
Expression constraint)
Assert#assertThat(char)public void assertThat(short result,
Expression constraint)
Assert#assertThat(short)public void assertThat(int result,
Expression constraint)
Assert#assertThat(int)public void assertThat(long result,
Expression constraint)
Assert#assertThat(long)public void assertThat(float result,
Expression constraint)
Assert#assertThat(float)public void assertThat(double result,
Expression constraint)
Assert#assertThat(double)public void setAsserter(Assert asserter)
public void setTestCaseListener(TestCaseListener testCaseListener)
public void setVerifiable(Verifiable verifiable)
protected Verifiable getVerifiable()
Copyright © 2005-2013 Agical AB. All Rights Reserved.