public class TestCaseBase extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
DIR_CLASSES
The root directory for class files.
|
protected static String |
DIR_ROOT
The root directory for test files.
|
protected static String |
DIR_TARGET
The root directory for target files.
|
protected static String |
DIR_TEST_CLASSES
The root directory for test class files.
|
| Constructor and Description |
|---|
TestCaseBase() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
assertEvent(org.apache.log4j.spi.LoggingEvent event,
org.apache.log4j.Level level,
String logger,
String message,
String location)
Asserts that the contents of the given event match the given
expected level, logger name, message, and location.
|
protected void |
assertEventCount(int count)
Asserts that the receiver's collector contains the given number
of events.
|
protected void |
assertLastEvent(org.apache.log4j.Level level,
String logger,
String message,
String location)
Asserts that the contents of the receiver's collector's most
recent event match the given expected level, logger name,
message, and location.
|
protected void |
assertNoEvents()
Asserts that the receiver's collector contains no events.
|
protected void |
assertSingleEvent(org.apache.log4j.Level level,
String logger,
String message,
String location)
Asserts that the receiver's collector contains a single event,
and that its contents match the given expected level, logger
name, message, and location.
|
protected void |
assertSomeEvent(org.apache.log4j.Level level,
String logger,
String message,
String location)
Asserts that at least one of the receiver's collector's events
matches the given expected level, logger name, message, and
location.
|
protected MemoryAppender |
getAppender()
Returns the receiver's collector (appender) of retained events.
|
protected LogTestAssist |
getLogAssist()
Returns the receiver's log message helper.
|
protected static void |
setDefaultLevel(org.apache.log4j.Level level)
Sets the level of the root logger to the given level.
|
protected static void |
setLevel(String name,
org.apache.log4j.Level level)
Sets the level of the logger with the given name to the given
level.
|
void |
setupTestCaseBase()
Sets up the receiver's collector of retained events as part of
each test's fixture.
|
protected static final String DIR_ROOT
protected static final String DIR_TARGET
protected static final String DIR_CLASSES
protected static final String DIR_TEST_CLASSES
protected static void setDefaultLevel(org.apache.log4j.Level level)
level - The level.protected static void setLevel(String name, org.apache.log4j.Level level)
name - The logger name.level - The level.protected static void assertEvent(org.apache.log4j.spi.LoggingEvent event,
org.apache.log4j.Level level,
String logger,
String message,
String location)
event - The event.level - The expected level. Use null to indicate "don't
care".logger - The expected logger name. Use null to indicate
"don't care".message - The expected message. Use null to indicate
"don't care".location - The expected location. Use null to indicate
"don't care".public void setupTestCaseBase()
protected LogTestAssist getLogAssist()
protected MemoryAppender getAppender()
protected void assertEventCount(int count)
count - The number of events.protected void assertNoEvents()
protected void assertLastEvent(org.apache.log4j.Level level,
String logger,
String message,
String location)
level - The expected level. Use null to indicate "don't
care".logger - The expected logger name. Use null to indicate
"don't care".message - The expected message. Use null to indicate
"don't care".location - The expected location. Use null to indicate
"don't care".protected void assertSomeEvent(org.apache.log4j.Level level,
String logger,
String message,
String location)
level - The expected level. Use null to indicate "don't
care".logger - The expected logger name. Use null to indicate
"don't care".message - The expected message. Use null to indicate
"don't care".location - The expected location. Use null to indicate
"don't care".protected void assertSingleEvent(org.apache.log4j.Level level,
String logger,
String message,
String location)
level - The expected level. Use null to indicate "don't
care".logger - The expected logger name. Use null to indicate
"don't care".message - The expected message. Use null to indicate
"don't care".location - The expected location. Use null to indicate
"don't care".Copyright © 2014. All Rights Reserved.