EsLookupBolt extends AbstractEsBolt { @Override public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { outputFieldsDeclarer.declare(output.fields()); } EsLookupBolt(EsConfig esConfig, ElasticsearchGetRequest getRequest, EsLookupResultOutput output); @Override void execute(Tuple tuple); @Override void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer);  }
@Test public void fieldsAreDeclaredThroughProvidedOutput() throws Exception { Fields fields = new Fields(UUID.randomUUID().toString()); when(output.fields()).thenReturn(fields); OutputFieldsDeclarer declarer = mock(OutputFieldsDeclarer.class); bolt.declareOutputFields(declarer); ArgumentCaptor<Fields> declaredFields = ArgumentCaptor.forClass(Fields.class); verify(declarer).declare(declaredFields.capture()); assertThat(declaredFields.getValue(), is(fields)); }