### Question:
StreamWriter implements Writer<T, PutRecordsResponse> { @Override public PutRecordsResponse put(List<T> records) throws IOException { return client.putRecords(PutRecordsRequest.builder() .streamName(streamName) .records(translator.toEntries(records)) .build()); } StreamWriter(String streamName, AbstractPutRecordsRequestTranslator<T> entryTranslator);  StreamWriter(KinesisClient client, String streamName,
                        AbstractPutRecordsRequestTranslator<T> translator); @Override PutRecordsResponse put(List<T> records);  }### Answer:
@Test public void put_GivenRecords_ShouldTranslateEachToPutRecordsRequestEntry() throws IOException { RecordTranslator translatorSpy = Mockito.spy(new RecordTranslator()); StreamWriter<SampleRecord> writer = new StreamWriter<>(client, streamName, translatorSpy); List<SampleRecord> records = ImmutableList.of(new SampleRecord()); writer.put(records); Mockito.verify(translatorSpy).toEntries(records); }
@Test public void put_GivenRecords_ShouldWriteToStream() throws IOException { StreamWriter<SampleRecord> writer = new StreamWriter<>(client, streamName, new RecordTranslator()); writer.put(ImmutableList.of(new SampleRecord())); ArgumentCaptor<PutRecordsRequest> arg = ArgumentCaptor.forClass(PutRecordsRequest.class); Mockito.verify(client).putRecords(arg.capture()); Assert.assertEquals(streamName, arg.getValue().streamName()); }