1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.core.appender;
15
16 import java.io.ByteArrayOutputStream;
17 import java.io.IOException;
18
19 import org.junit.jupiter.api.Test;
20
21 import ch.qos.logback.core.Appender;
22 import ch.qos.logback.core.testUtil.DummyEncoder;
23 import ch.qos.logback.core.encoder.Encoder;
24 import ch.qos.logback.core.layout.DummyLayout;
25
26 import static org.junit.jupiter.api.Assertions.assertEquals;
27
28 public class DummyAppenderTest extends AbstractAppenderTest<Object> {
29
30 ByteArrayOutputStream baos = new ByteArrayOutputStream();
31 DummyWriterAppender<Object> da = new DummyWriterAppender<Object>(baos);
32
33 protected Appender<Object> getAppender() {
34 return da;
35 }
36
37 protected Appender<Object> getConfiguredAppender() {
38 da.setEncoder(new DummyEncoder<Object>());
39 da.start();
40 return da;
41 }
42
43 @Test
44 public void testBasic() throws IOException {
45 Encoder<Object> encoder = new DummyEncoder<Object>();
46 da.setEncoder(encoder);
47 da.start();
48 da.doAppend(new Object());
49 assertEquals(DummyLayout.DUMMY, baos.toString());
50 }
51
52 }