LayoutTestpublic class LayoutTest extends TestCase
Fields Summary |
---|
private final String | contentTypeExpected content type. | private final boolean | ignoresThrowableExpected value for ignoresThrowable. | private final String | headerExpected value for header. | private final String | footerExpected value for footer. |
Constructors Summary |
---|
public LayoutTest(String testName)Construct a new instance of LayoutTest.
super(testName);
contentType = "text/plain";
ignoresThrowable = true;
header = null;
footer = null;
| protected LayoutTest(String testName, String expectedContentType, boolean expectedIgnoresThrowable, String expectedHeader, String expectedFooter)Constructor for use by derived tests.
super(testName);
contentType = expectedContentType;
ignoresThrowable = expectedIgnoresThrowable;
header = expectedHeader;
footer = expectedFooter;
|
Methods Summary |
---|
protected org.apache.log4j.Layout | createLayout()Creates layout for test.
return new MockLayout();
| public void | testFormat()Tests format.
Logger logger = Logger.getLogger("org.apache.log4j.LayoutTest");
LoggingEvent event =
new LoggingEvent(
"org.apache.log4j.Logger", logger, Level.INFO, "Hello, World", null);
String result = createLayout().format(event);
assertEquals("Mock", result);
| public void | testGetContentType()Tests getContentType.
assertEquals(contentType, createLayout().getContentType());
| public void | testGetFooter()Tests getFooter.
assertEquals(footer, createLayout().getFooter());
| public void | testGetHeader()Tests getHeader.
assertEquals(header, createLayout().getHeader());
| public void | testIgnoresThrowable()Tests ignoresThrowable.
assertEquals(ignoresThrowable, createLayout().ignoresThrowable());
| public void | testLineSep()Tests Layout.LINE_SEP.
assertEquals(System.getProperty("line.separator"), Layout.LINE_SEP);
| public void | testLineSepLen()Tests Layout.LINE_SEP.
assertEquals(Layout.LINE_SEP.length(), Layout.LINE_SEP_LEN);
|
|