StructuredLoggerFactory { public StructuredLogger getLogger(final Class<?> clazz) { return getLogger(clazz.getName()); } StructuredLoggerFactory(final String prefix);   StructuredLoggerFactory(final String prefix, final Function<String, Logger> inner); StructuredLogger getLogger(final Class<?> clazz); StructuredLogger getLogger(final String name); Collection<String> getLoggers();  }
@Test public void shouldCreateLoggerCorrectly() { when(innerFactory.apply("prefix.foo")).thenReturn(innerLogger); final StructuredLogger logger = loggerFactory.getLogger("foo"); logger.info(mock(SchemaAndValue.class)); verify(innerFactory, times(1)).apply("prefix.foo"); verify(innerLogger).info(any(String.class), any(SerializableSchemaAndValue.class)); }
@Test public void shouldAddPrefixToClassName() { when(innerFactory.apply("prefix.java.util.Map")).thenReturn(innerLogger); loggerFactory.getLogger(Map.class); verify(innerFactory, times(1)).apply("prefix.java.util.Map"); }