ConstBolt extends BaseBasicBolt { @Override public void execute(Tuple tuple, BasicOutputCollector collector) { collector.emit(new Values(tuple.getValue(0))); } ConstBolt(); @Override void prepare(Map conf, TopologyContext context); @Override void execute(Tuple tuple, BasicOutputCollector collector); @Override void declareOutputFields(OutputFieldsDeclarer declarer); static final String FIELDS; }
@Test public void shouldEmitFirstFieldOfTuple() { bolt.execute(tuple, collector); verify(tuple, times(1)).getValue(0); verify(collector, times(1)).emit(any(Values.class)); }