### Question:
AnnotationDefinitionFactory { public OutLog buildOutLog(Set<String> loggerNames, Method method) { Log.out logOut = annotationExtractor.findLogOut(method, loggerNames); if (nonNull(logOut)) { return buildOutLog(method, logOut); } Log log = annotationExtractor.findLog(method, loggerNames); if (nonNull(log)) { return buildOutLog(method, annotationExtractor.synthesizeLogOut(log)); } return null; } AnnotationDefinitionFactory(PrinterResolver printerResolver); InLog buildInLog(Set<String> loggerNames, Method method); List<ParameterLog> buildParameterLogs(Set<String> loggerNames, Method method); OutLog buildOutLog(Set<String> loggerNames, Method method); Set<ErrorLog> buildErrorLogs(Set<String> loggerNames, Method method); Set<ParameterMdc> buildMethodParameterMdcs(Method method); List<Set<ParameterMdc>> buildParameterMdcs(Method method);  }### Answer:
@Test public void buildOutLog() throws NoSuchMethodException { Set<String> loggerNames = singleton(""); Method method = LogOutLoggableClass.class.getDeclaredMethod("logOut"); OutLog outLog = annotationDefinitionFactory.buildOutLog(loggerNames, method); assertNotNull(outLog); assertThat(outLog.getLevel(), is(INFO)); }
@Test public void buildOutLogByLog() throws NoSuchMethodException { Set<String> loggerNames = singleton(""); Method method = LogOutLoggableClass.class.getDeclaredMethod("log"); OutLog outLog = annotationDefinitionFactory.buildOutLog(loggerNames, method); assertNotNull(outLog); assertThat(outLog.getLevel(), is(WARN)); assertThat(outLog.getIfEnabledLevel(), is(ERROR)); assertThat(outLog.getVerboseLevel(), is(TRACE)); assertThat(outLog.getPrinter(), is(jsonPrinter)); }
@Test public void buildOutLogByLogWithAlias() throws NoSuchMethodException { Set<String> loggerNames = singleton(""); Method method = LogOutLoggableClass.class.getDeclaredMethod("logWithAlias"); OutLog outLog = annotationDefinitionFactory.buildOutLog(loggerNames, method); assertNotNull(outLog); assertThat(outLog.getLevel(), is(WARN)); }
@Test public void buildOutLogEmpty() throws NoSuchMethodException { Set<String> loggerNames = singleton(""); Method method = LogOutLoggableClass.class.getDeclaredMethod("empty"); OutLog outLog = annotationDefinitionFactory.buildOutLog(loggerNames, method); assertThat(outLog, nullValue()); }
@Test public void buildOutLogByLogOuts() throws NoSuchMethodException { Set<String> loggerNames = singleton(""); Method method = LogOutLoggableClass.class.getDeclaredMethod("logOuts"); OutLog outLog = annotationDefinitionFactory.buildOutLog(loggerNames, method); assertNotNull(outLog); assertThat(outLog.getLevel(), is(ERROR)); }
@Test public void buildOutLogByLogs() throws NoSuchMethodException { Set<String> loggerNames = singleton(""); Method method = LogOutLoggableClass.class.getDeclaredMethod("logs"); OutLog outLog = annotationDefinitionFactory.buildOutLog(loggerNames, method); assertNotNull(outLog); assertThat(outLog.getLevel(), is(ERROR)); }