@Test
public void onImageAvailableWithPaddedImageBufferStripsPaddingBeforeCopyingPixels() {

  widthStub = 2;
  heightStub = 2;
  int rowPaddingBytes = 1;
  rowStrideStub = (pixelStrideStub * widthStub + rowPaddingBytes);
  imagePlaneStubBuffer =
      ByteBuffer.wrap(new byte[] {1, 1, 1, 1, 2, 2, 2, 2, 0, 3, 3, 3, 3, 4, 4, 4, 4, 0});
  ByteBuffer bufferWithPaddingRemoved =
      ByteBuffer.wrap(new byte[] {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4});
  setupMocksToCreateBitmap();
  testSubject.onImageAvailable(imageReaderMock);
  verify(bitmapMock, times(1)).copyPixelsFromBuffer(eq(bufferWithPaddingRemoved));
  verify(bitmapConsumerMock, times(1)).accept(bitmapMock);
}