View Javadoc
1   package org.slf4j.impl;
2   
3   import org.junit.Test;
4   
5   import org.slf4j.MDC;
6   import uk.org.lidalia.slf4jtest.TestMDCAdapter;
7   
8   import static org.hamcrest.Matchers.is;
9   import static org.junit.Assert.assertEquals;
10  import static org.junit.Assert.assertSame;
11  import static org.junit.Assert.assertThat;
12  
13  public class StaticMDCBinderTests {
14  
15      @Test
16      public void getMDCA() throws Exception {
17          assertSame(TestMDCAdapter.class, StaticMDCBinder.SINGLETON.getMDCA().getClass());
18          assertSame(StaticMDCBinder.SINGLETON.getMDCA(), StaticMDCBinder.SINGLETON.getMDCA());
19      }
20  
21      @Test
22      public void getMDCAdapterClassStr() throws Exception {
23          assertEquals("uk.org.lidalia.slf4jtest.TestMDCAdapter", StaticMDCBinder.SINGLETON.getMDCAdapterClassStr());
24      }
25  
26      @Test
27      public void getMarkerFactoryReturnsCorrectlyFromSlf4JLoggerFactory() {
28          assertThat(MDC.getMDCAdapter(), is(StaticMDCBinder.SINGLETON.getMDCA()));
29      }
30  }