TinylogMdcAdapter implements MDCAdapter { @Override public Map<String, String> getCopyOfContextMap() { return new HashMap<String, String>(ThreadContext.getMapping()); } TinylogMdcAdapter(); @Override void put(final String key, final String value); @Override String get(final String key); @Override void remove(final String key); @Override void clear(); @Override Map<String, String> getCopyOfContextMap(); @Override void setContextMap(final Map<String, String> contextMap);  }
@Test public void getCopyOfContextMap() { Map<String, String> currentMap = Collections.singletonMap("test", "42"); when(provider.getMapping()).thenReturn(currentMap); assertThat(new TinylogMdcAdapter().getCopyOfContextMap()).isEqualTo(currentMap).isNotSameAs(currentMap); }