public abstract class Reporter extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Reporter.Message
A container of message information to be processed by
Reporter . |
Modifier and Type | Field and Description |
---|---|
static int |
ERROR
the level at which error messages are generated
|
private static int |
errorCount
the error count
|
private static boolean |
explain
flag controlling display of explanation text
|
private static HashSet |
explanationsGiven
table of explanations which have been output, to inhibit duplicates
|
static int |
INFO
the level at which information messages are generated
|
private static String[] |
msgHeaders
the header labels for the test result records
|
private static int |
reportingLevel
the display reportingLevel
|
private static String |
sourceString
the header label for the source record
|
private static boolean |
traces
flag controlling printing stack traces
|
static int |
WARNING
the level at which warning messages are generated
|
private static int |
warningCount
the warning count
|
Modifier | Constructor and Description |
---|---|
private |
Reporter() |
Modifier and Type | Method and Description |
---|---|
static int |
getErrorCount()
Get the total number of error records that were generated.
|
static int |
getWarningCount()
Get the total number of warning records that were generated.
|
static void |
print(Reporter.Message message)
Generate the output for
message . |
static void |
print(Reporter.Message message,
String source)
Generate the output for
message. |
private static void |
printExplanation(Reporter.Message message)
Output the explanation text supplied by
message. |
static void |
setExplanation(boolean explain)
Set the explanation generation flag;
|
static void |
setLevel(int level)
Set the reporting level.
|
static void |
setPrintTraces(boolean traces)
Set the flag controlling printing of stack traces.
|
public static final int INFO
public static final int WARNING
public static final int ERROR
private static String sourceString
private static String[] msgHeaders
private static boolean explain
private static int reportingLevel
private static int warningCount
private static int errorCount
private static boolean traces
private static HashSet explanationsGiven
public static void setLevel(int level)
level
- the max level to generate outputpublic static void setExplanation(boolean explain)
explain
- the value to set the flag topublic static void setPrintTraces(boolean traces)
traces
- if true
, print stack tracespublic static void print(Reporter.Message message)
message
. This method is silent
if the message level is less than reportLevel
.
If explain
is true
, the explanation text
will be output only the first time it is encountered.message
- the Message
to printpublic static void print(Reporter.Message message, String source)
message.
This method is silent if
the message level is less than Reporter.level
. If
Reporter.explain
is true
, the explanation text
will be output only the first time it is encountered. If
source
is null
, the source record is not
output. If the message level is error or warning, the appropriate counter
is updated.message
- the Message
to printsource
- additional information identifying the component under testprivate static void printExplanation(Reporter.Message message)
message.
If there is
no explanation text, or if the text has been output previously, this
method returns. Otherwise the text is output. Formatting is applied if
message.formatExplanation()
returns true
.message
- the Message
to explainpublic static int getWarningCount()
public static int getErrorCount()
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.