@Test
public void testRewind() throws IOException {

  // Read all the data.
  byteArrayUploadDataProvider.read(mockUploadDataSink, byteBuffer);
  assertThat(byteBuffer.array()).isEqualTo(TEST_DATA);
  // Rewind and make sure it can be read again.
  byteBuffer.clear();
  byteArrayUploadDataProvider.rewind(mockUploadDataSink);
  byteArrayUploadDataProvider.read(mockUploadDataSink, byteBuffer);
  assertThat(byteBuffer.array()).isEqualTo(TEST_DATA);
  verify(mockUploadDataSink).onRewindSucceeded();
}