PageViewBolt extends BaseBasicBolt { @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields(field1.toString(), field2.toString())); } PageViewBolt(Item field1, Item field2); @Override void execute(Tuple input, BasicOutputCollector collector); @Override void declareOutputFields(OutputFieldsDeclarer declarer); final Item field1; final Item field2; }
@Test(dataProvider = "getAnyFields") public void shouldDeclareOutputFields(Item field1, Item field2) { PageViewBolt bolt = new PageViewBolt(field1, field2); OutputFieldsDeclarer declarer = mock(OutputFieldsDeclarer.class); bolt.declareOutputFields(declarer); verify(declarer, times(1)).declare(any(Fields.class)); }