|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTestCase
prantl.ant.eclipse.BuildFileTestBase
public abstract class BuildFileTestBase
Simplifies testing of an ant task with a prepared build file automating the task execution and providing content of the log, standard output and error and an eventual exception.
Constructor Summary | |
---|---|
protected |
BuildFileTestBase(java.lang.String name)
Passes the construction of a new instance of the test fixture from the descendant to the ancestor. |
Method Summary | |
---|---|
protected void |
assertBuildExceptionContains(java.lang.String part)
Checks that the message of the last thrown exception has the specified value as a substring. |
protected void |
assertBuildExceptionEquals(java.lang.String message)
Checks that the message of the last thrown exception has the specified value. |
protected void |
assertErrorContains(java.lang.String part)
Checks that the captured standard error has the specified value as a substring. |
protected void |
assertErrorEquals(java.lang.String content)
Checks that the captured standard error has the specified content. |
protected void |
assertLogContains(java.lang.String part)
Checks that the captured log has the specified value as a substring. |
protected void |
assertLogEquals(java.lang.String content)
Checks that the captured log has the specified content. |
protected void |
assertOutputContains(java.lang.String part)
Checks that the captured standard output has the specified value as a substring. |
protected void |
assertOutputEquals(java.lang.String content)
Checks that the captured standard output has the specified content. |
protected void |
assertPropertyContains(java.lang.String property,
java.lang.String part)
Checks that the property has the specified value as a substring. |
protected void |
assertPropertyEquals(java.lang.String property,
java.lang.String value)
Checks that the property has the specified value. |
protected void |
assertPropertyFalse(java.lang.String property)
Checks that the property has been set to false. |
protected void |
assertPropertyTrue(java.lang.String property)
Checks that the property has been set to true. |
protected void |
assertPropertyUnset(java.lang.String property)
Checks that the property has never been set. |
protected void |
executeFailingTarget(java.lang.String targetName,
java.lang.String cause)
Executes the specified target expecting an exception to be thrown during the run. |
protected void |
executeTarget(java.lang.String targetName)
Executes the specified target expecting a successful run. |
protected BuildException |
getBuildException()
Gets the most recently thrown exception instance or null if there has been none thrown (the task execution was successful). |
protected java.lang.String |
getError()
Gets the most recent standard error or null if there has been none written yet. |
protected java.lang.String |
getLog()
Gets the most recent log or null if there has been none written yet. |
protected java.lang.String |
getOutput()
Gets the most recent standard output or null if there has been none written yet. |
protected Project |
getProject()
Gets the project, which has been most recently initialized or null if there has been none yet. |
protected java.lang.String |
normalizeEolns(java.lang.StringBuffer buffer)
Returns a new string copy with all possible forms of an end-of-line delimiter made of carriage-return and/or line-feed (\r, \n, \r\n) replaced by a single line-feed character (\n). |
protected void |
parseBuildFile(java.lang.String fileName)
Initializes a new project from the specified build file capturing selected traces. |
protected void |
parseInvalidBuildFile(java.lang.String fileName,
java.lang.String cause)
Initializes a new project from the specified build file capturing selected traces and expecting an exception to be thrown during the parsing. |
protected void |
setLogLevel(int logLevel)
Sets the maximum log level of messages to be captured. |
protected void |
setTargetName(java.lang.String targetName)
Sets the name of the target, which traces only will be captured. |
protected void |
setTaskName(java.lang.String taskName)
Sets the name of the task, which traces only will be captured. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected BuildFileTestBase(java.lang.String name)
name
- The name of the test fixture.TestCase#TestCase(String)
Method Detail |
---|
protected void setTargetName(java.lang.String targetName)
targetName
- The name of the target to capture the traces of.protected void setTaskName(java.lang.String taskName)
taskName
- The name of the target to capture the traces of.protected void setLogLevel(int logLevel)
logLevel
- Maximum log level of the captured traces.protected void parseBuildFile(java.lang.String fileName)
fileName
- The name of the project file to process.
java.lang.NullPointerException
- If the parameter fileName is null.protected void parseInvalidBuildFile(java.lang.String fileName, java.lang.String cause)
fileName
- The name of the project file to process.cause
- The reason why the exception should have been thrown
java.lang.NullPointerException
- If the parameters fileName or cause are null.protected void executeTarget(java.lang.String targetName)
targetName
- The name of the target to execute.
BuildException
- If the parameter targetName is null.protected void executeFailingTarget(java.lang.String targetName, java.lang.String cause)
targetName
- The name of the target to execute.cause
- The reason why the exception should have been thrown if it had not happened
to be written in a sentence after 'bacause'.
BuildException
- If the parameters targetName or cause are
null.protected Project getProject()
protected java.lang.String getLog()
protected java.lang.String getOutput()
protected java.lang.String getError()
protected BuildException getBuildException()
protected void assertLogEquals(java.lang.String content)
content
- The content to be matched.protected void assertLogContains(java.lang.String part)
part
- The part of the content to be searched for.protected void assertOutputEquals(java.lang.String content)
content
- The content to be matched.protected void assertOutputContains(java.lang.String part)
part
- The part of the content to be searched for.protected void assertErrorEquals(java.lang.String content)
content
- The content to be matched.protected void assertErrorContains(java.lang.String part)
part
- The part of the content to be searched for.protected void assertBuildExceptionEquals(java.lang.String message)
message
- The message to be matched.protected void assertBuildExceptionContains(java.lang.String part)
part
- The part of the message to be searched for.protected void assertPropertyEquals(java.lang.String property, java.lang.String value)
property
- The name of the property to check.value
- The expected value.protected void assertPropertyContains(java.lang.String property, java.lang.String part)
property
- The name of the property to check.part
- The part of the value to be searched for.protected void assertPropertyTrue(java.lang.String property)
property
- The name of the property to check.protected void assertPropertyFalse(java.lang.String property)
property
- The name of the property to check.protected void assertPropertyUnset(java.lang.String property)
property
- The name of the property to check.protected java.lang.String normalizeEolns(java.lang.StringBuffer buffer)
buffer
- The source buffer to normalize eolns in.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |