TupleStreamBuilder { public TupleStream build() { TupleStream tupleStream = getRawTupleStream(); StreamContext streamContext = new StreamContext(); streamContext.setSolrClientCache(SOLR_CLIENT_CACHE); tupleStream.setStreamContext(streamContext); return tupleStream; }  TupleStream build();  }
@Test void solrClientCacheIsReusedInStreamContext() { new DummyTupleStreamBuilder().build(); new DummyTupleStreamBuilder().build(); ArgumentCaptor<StreamContext> argument = ArgumentCaptor.forClass(StreamContext.class); verify(tupleStreamMock, times(2)).setStreamContext(argument.capture()); assertThat(argument.getAllValues().get(0).getSolrClientCache()) .isSameAs(argument.getAllValues().get(1).getSolrClientCache()); }