AbstractLoggingBolt extends AbstractProcessingBolt { protected void log(Logger logger, String message) { switch (level.toInt()) { case Level.TRACE_INT: logger.trace(message); break; case Level.DEBUG_INT: logger.debug(message); break; case Level.INFO_INT: logger.info(message); break; case Level.WARN_INT: logger.warn(message); break; case Level.ERROR_INT: logger.error(message); break; default: logger.debug(message); } }  @Override void configure(Configuration conf); static final String LEVEL; }
@Test public void testLogTrace(@Injectable Logger logger) throws Exception { bolt.level = Level.TRACE; new Expectations() {{ logger.trace("msg"); }}; bolt.log(logger, "msg"); }
@Test public void testLogDebug(@Injectable Logger logger) throws Exception { bolt.level = Level.DEBUG; new Expectations() {{ logger.debug("msg"); }}; bolt.log(logger, "msg"); }
@Test public void testLogInfo(@Injectable Logger logger) throws Exception { bolt.level = Level.INFO; new Expectations() {{ logger.info("msg"); }}; bolt.log(logger, "msg"); }
@Test public void testLogWarn(@Injectable Logger logger) throws Exception { bolt.level = Level.WARN; new Expectations() {{ logger.warn("msg"); }}; bolt.log(logger, "msg"); }
@Test public void testLogError(@Injectable Logger logger) throws Exception { bolt.level = Level.ERROR; new Expectations() {{ logger.error("msg"); }}; bolt.log(logger, "msg"); }
@Test public void testLogDefault(@Injectable Logger logger) throws Exception { bolt.level = Level.FATAL; new Expectations() {{ logger.debug("msg"); }}; bolt.log(logger, "msg"); }