public void testFormat() {
NDC.clear();
NDC.push("NDC goes here");
Logger logger = Logger.getLogger("org.apache.log4j.LayoutTest");
LoggingEvent event =
new LoggingEvent(
"org.apache.log4j.Logger", logger, Level.INFO, "Hello, World", null);
TTCCLayout layout = (TTCCLayout) createLayout();
String result = layout.format(event);
NDC.pop();
StringBuffer buf = new StringBuffer(100);
layout.dateFormat(buf, event);
buf.append('[');
buf.append(event.getThreadName());
buf.append("] ");
buf.append(event.getLevel().toString());
buf.append(' ');
buf.append(event.getLoggerName());
buf.append(' ');
buf.append("NDC goes here");
buf.append(" - ");
buf.append(event.getMessage());
buf.append(System.getProperty("line.separator"));
assertEquals(buf.toString(), result);
}