SelectStreamBuilder extends TupleStreamBuilder { public SelectStreamBuilder addFieldMapping(Map<String, String> fieldNamesMap) { fieldMapsBuilder.putAll(fieldNamesMap); return this; } SelectStreamBuilder(TupleStreamBuilder tupleStreamBuilder); SelectStreamBuilder addFieldMapping(Map<String, String> fieldNamesMap);  }
@Test public void fieldsAreRenamed() { int size = ThreadLocalRandom.current().nextInt(1, 1000); DummyTupleStreamBuilder<AnalyticsCollectionProxy> tupleStreamBuilderMock = DummyTupleStreamBuilder.create(size); SelectStreamBuilder subject = new SelectStreamBuilder(tupleStreamBuilderMock) .addFieldMapping(ImmutableMap.of("field1", "fieldA", "field2", "fieldB")); assertThat(TupleStreamer.of(subject.build()).get().collect(toList())) .hasSize(size) .allMatch( tuple -> tuple.getMap().keySet().contains("fieldA") && tuple.getMap().keySet().contains("fieldB")) .areNot( new Condition<>( tuple -> tuple.getMap().keySet().contains("field1") || tuple.getMap().keySet().contains("field2"), "Does not contain field1 or field2")); }