Search in sources :

Example 1 with InMemoryAppender

use of org.apache.logging.log4j.test.appender.InMemoryAppender in project logging-log4j2 by apache.

the class InMemoryAppenderTest method testHeaderRequested.

@Test
public void testHeaderRequested() {
    final PatternLayout layout = PatternLayout.newBuilder().withHeader("HEADERHEADER").build();
    final boolean writeHeader = true;
    final InMemoryAppender app = new InMemoryAppender("test", layout, null, false, writeHeader);
    final String expectedHeader = "HEADERHEADER";
    assertMessage("Test", app, expectedHeader);
}
Also used : InMemoryAppender(org.apache.logging.log4j.test.appender.InMemoryAppender) PatternLayout(org.apache.logging.log4j.core.layout.PatternLayout) Test(org.junit.Test)

Example 2 with InMemoryAppender

use of org.apache.logging.log4j.test.appender.InMemoryAppender in project logging-log4j2 by apache.

the class InMemoryAppenderTest method testAppender.

@Test
public void testAppender() {
    final Layout<String> layout = PatternLayout.createDefaultLayout();
    final boolean writeHeader = true;
    final InMemoryAppender app = new InMemoryAppender("test", layout, null, false, writeHeader);
    final String expectedHeader = null;
    assertMessage("Test", app, expectedHeader);
}
Also used : InMemoryAppender(org.apache.logging.log4j.test.appender.InMemoryAppender) Test(org.junit.Test)

Example 3 with InMemoryAppender

use of org.apache.logging.log4j.test.appender.InMemoryAppender in project logging-log4j2 by apache.

the class InMemoryAppenderTest method testHeaderSuppressed.

@Test
public void testHeaderSuppressed() {
    final PatternLayout layout = PatternLayout.newBuilder().withHeader("HEADERHEADER").build();
    final boolean writeHeader = false;
    final InMemoryAppender app = new InMemoryAppender("test", layout, null, false, writeHeader);
    final String expectedHeader = null;
    assertMessage("Test", app, expectedHeader);
}
Also used : InMemoryAppender(org.apache.logging.log4j.test.appender.InMemoryAppender) PatternLayout(org.apache.logging.log4j.core.layout.PatternLayout) Test(org.junit.Test)

Aggregations

InMemoryAppender (org.apache.logging.log4j.test.appender.InMemoryAppender)3 Test (org.junit.Test)3 PatternLayout (org.apache.logging.log4j.core.layout.PatternLayout)2