JCLOUDS-1358: Fix zero byte InputStream test input

Do not use ByteSource.empty() since it is backed by a
ByteArrayInputStream which supports reset.
This commit is contained in:
Andrew Gaul 2017-11-21 10:49:53 -08:00
parent 5d82a3df97
commit d29b79674d
1 changed files with 7 additions and 2 deletions

View File

@ -645,14 +645,19 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
@Test(groups = { "integration", "live" })
public void testPutZeroLengthByteSource() throws Exception {
long length = 0;
Payload payload = new ByteSourcePayload(ByteSource.empty());
// do not use ByteSource.empty() since it is backed by a
// ByteArrayInputStream which supports reset
ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
Payload payload = new ByteSourcePayload(byteSource);
testPut(payload, null, payload, length, new PutOptions());
}
@Test(groups = { "integration", "live" })
public void testPutZeroLengthInputStream() throws Exception {
long length = 0;
ByteSource byteSource = ByteSource.empty();
// do not use ByteSource.empty() since it is backed by a
// ByteArrayInputStream which supports reset
ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
Payload payload = new InputStreamPayload(byteSource.openStream());
testPut(payload, null, payload, length, new PutOptions());
}