### Question:
ApimlDependencyLogHider extends TurboFilter { @Override public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) { if (!isFilterActive || format == null || isLowThanInfoLevel(logger.getEffectiveLevel())) { return FilterReply.NEUTRAL; } if (t != null) { format += Stream.of(ExceptionUtils.getStackFrames(t)).collect(Collectors.joining()); } return getFilterReply(format); } ApimlDependencyLogHider(); @Override FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t);  }### Answer:
@Test public void testDecide_whenApplicationRunningInDebugMode() { System.getProperties().setProperty("spring.profiles.include", "debug"); ApimlDependencyLogHider apimlDependencyLogHider = new ApimlDependencyLogHider(); FilterReply actualFilterReply = apimlDependencyLogHider.decide(null, logger, null, "Message text", null, null); assertEquals("Log levels are not same", FilterReply.NEUTRAL, actualFilterReply); }
@Test public void testDecide_whenLoggerLevelIsLowThanInfo() { logger.setLevel(Level.DEBUG); FilterReply actualFilterReply = apimlDependencyLogHider.decide(null, logger, null, "Message text", null, null); assertEquals("Log levels are not same", FilterReply.NEUTRAL, actualFilterReply); }
@Test public void testDecide_whenIgnoredMessagesArePresent() { logger.setLevel(Level.INFO); Map<String, Boolean> logMessages = new HashMap<>(); logMessages.put("Tomcat initialized with port(s): 10011 (https)", true); logMessages.put("The replica size seems to be empty. Check the route 53 DNS Registry", true); logMessages.put("Peer wants us to take the instance information from it, since the timestamp differs," + "Id : {} My Timestamp : {}, Peer's timestamp: {}", true); logMessages.put("The replication of task {} failed with response code {}", true); logMessages.put("Test message", false); logMessages.forEach((logMessage, shouldBeIgnored) -> { FilterReply actualFilterReply = apimlDependencyLogHider.decide(null, logger, null, logMessage, null, null); FilterReply expectedFilterReply = shouldBeIgnored ? FilterReply.DENY : FilterReply.NEUTRAL; assertEquals("Log levels are not same", expectedFilterReply, actualFilterReply); }); }
@Test public void testDecide_whenIgnoredMessagesArePresentWithException() { logger.setLevel(Level.ERROR); String format = "Error during filtering"; RuntimeException filterException = new RuntimeException("Token is not valid"); FilterReply actualFilterReply = apimlDependencyLogHider.decide(null, logger, null, format, null, filterException); FilterReply expectedFilterReply = FilterReply.DENY; assertEquals("Log levels are not same", expectedFilterReply, actualFilterReply); }