public class FormatterElement
extends java.lang.Object
A wrapper for the implementations of JUnitResultFormatter
.
In particular, used as a nested <formatter>
element in
a <junit>
task.
<junit printsummary="no" haltonfailure="yes" fork="false"> <formatter type="plain" usefile="false" /> <test name="org.apache.ecs.InternationalCharTest" /> </junit>adds a
plain
type implementation
(PlainJUnitResultFormatter
) to display the results of the test.
Either the type
or the classname
attribute
must be set.
Modifier and Type | Class and Description |
---|---|
static class |
FormatterElement.TypeAttribute
Enumerated attribute with the values "plain", "xml", "brief" and "failure".
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BRIEF_FORMATTER_CLASS_NAME
brief formatter class
|
static java.lang.String |
FAILURE_RECORDER_CLASS_NAME
failure recorder class
|
static java.lang.String |
PLAIN_FORMATTER_CLASS_NAME
plain formatter class
|
static java.lang.String |
XML_FORMATTER_CLASS_NAME
xml formatter class
|
Constructor and Description |
---|
FormatterElement() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getClassname()
Get name of class to be used as the formatter.
|
java.lang.String |
getExtension()
Get the extension used for the report file.
|
void |
setClassname(java.lang.String classname)
Set name of class to be used as the formatter.
|
void |
setExtension(java.lang.String ext)
Set the extension to use for the report file.
|
void |
setIf(java.lang.Object ifCond)
Set whether this formatter should be used.
|
void |
setIf(java.lang.String ifCond)
Set whether this formatter should be used.
|
void |
setOutput(java.io.OutputStream out)
Set output stream for formatter to use.
|
void |
setProject(Project project)
Store the project reference for passing it to nested components.
|
void |
setType(FormatterElement.TypeAttribute type)
Quick way to use a standard formatter.
|
void |
setUnless(java.lang.Object unlessCond)
Set whether this formatter should NOT be used.
|
void |
setUnless(java.lang.String unlessCond)
Set whether this formatter should NOT be used.
|
void |
setUseFile(boolean useFile)
Set whether the formatter should log to file.
|
boolean |
shouldUse(Task t)
Ensures that the selector passes the conditions placed
on it with
if and unless properties. |
public static final java.lang.String XML_FORMATTER_CLASS_NAME
public static final java.lang.String BRIEF_FORMATTER_CLASS_NAME
public static final java.lang.String PLAIN_FORMATTER_CLASS_NAME
public static final java.lang.String FAILURE_RECORDER_CLASS_NAME
public void setType(FormatterElement.TypeAttribute type)
Quick way to use a standard formatter.
At the moment, there are three supported standard formatters.
xml
type uses a XMLJUnitResultFormatter
.brief
type uses a BriefJUnitResultFormatter
.plain
type (the default) uses a PlainJUnitResultFormatter
.failure
type uses a FailureRecorder
.Sets classname
attribute - so you can't use that
attribute if you use this one.
type
- the enumerated value to use.public void setClassname(java.lang.String classname)
This class must implement JUnitResultFormatter
classname
- the name of the formatter class.public java.lang.String getClassname()
public void setExtension(java.lang.String ext)
ext
- the extension to use.public java.lang.String getExtension()
public void setOutput(java.io.OutputStream out)
Defaults to standard out.
out
- the output stream to use.public void setUseFile(boolean useFile)
useFile
- if true use a file, if false send
to standard out.public void setIf(java.lang.Object ifCond)
ifCond
- name of propertypublic void setIf(java.lang.String ifCond)
ifCond
- name of propertypublic void setUnless(java.lang.Object unlessCond)
unlessCond
- name of propertypublic void setUnless(java.lang.String unlessCond)
unlessCond
- name of propertypublic boolean shouldUse(Task t)
if
and unless
properties.t
- the task the this formatter is used in.public void setProject(Project project)
project
- the reference