SkipFieldValueBolt extends AbstractLogicBolt { @Override protected boolean shouldEmit(LogRecord record) { String value = record.getValue(field); if (StringUtils.equals(value, this.value)) return false; else return true; }  @Override void configure(Configuration conf); static final String FIELD; static final String VALUE; }
@Test public void testShouldEmit0(@Mocked final LogRecord record) throws Exception { bolt.field = "field"; bolt.value = "value"; new Expectations() {{ record.getValue(bolt.field); result = "asdf"; }}; Assert.assertThat(bolt.shouldEmit(record), Is.is(true)); }
@Test public void testShouldEmit1(@Mocked final LogRecord record) throws Exception { bolt.field = "field"; bolt.value = "value"; new Expectations() {{ record.getValue(bolt.field); result = "value"; }}; Assert.assertThat(bolt.shouldEmit(record), Is.is(false)); }