1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.core.read;
15
16 import org.junit.jupiter.api.BeforeEach;
17 import org.junit.jupiter.api.Test;
18
19 import static org.junit.jupiter.api.Assertions.assertEquals;
20
21 public class CyclicBufferAppenderTest {
22
23 private CyclicBufferAppender<String> cyclicBufferAppender;
24
25 @BeforeEach
26 public void before() {
27 cyclicBufferAppender = new CyclicBufferAppender<String>();
28 cyclicBufferAppender.start();
29 }
30
31 @Test
32 public void reset() {
33
34 cyclicBufferAppender.append("foobar");
35 assertEquals(1, cyclicBufferAppender.getLength());
36 cyclicBufferAppender.reset();
37 assertEquals(0, cyclicBufferAppender.getLength());
38 }
39
40 @Test
41 public void genericGet() {
42 cyclicBufferAppender.append("Some string");
43
44 String foo = cyclicBufferAppender.get(0);
45 assertEquals("Some string", foo);
46 }
47
48 }