TreasureDataIngester implements Ingester { @Override public void ingest(String tag, ByteBuffer dataBuffer) throws IOException { sender.send(tag, dataBuffer); } TreasureDataIngester(TreasureDataSender sender); @Override void ingest(String tag, ByteBuffer dataBuffer); @Override Sender getSender(); @Override void close();  }
@Test void ingest() throws IOException { TreasureDataIngester ingester = new TreasureDataIngester(treasureDataSender); ingester.ingest(TAG, ByteBuffer.wrap(DATA)); ArgumentCaptor<ByteBuffer> byteBufferArgumentCaptor = ArgumentCaptor.forClass(ByteBuffer.class); verify(treasureDataSender, times(1)).send(eq(TAG), byteBufferArgumentCaptor.capture()); assertEquals(1, byteBufferArgumentCaptor.getAllValues().size()); assertArrayEquals(DATA, byteBufferArgumentCaptor.getAllValues().get(0).array()); }