Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: Sandeep Kumawat <2025sandeepkumawat@gmail.com>
  • Loading branch information
skumawat2025 committed Apr 11, 2024
1 parent b2fe597 commit 8247c56
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.any;
Expand All @@ -61,6 +63,15 @@ public void testInputStreamFullyConsumed() throws IOException {
assertThat(stream.isAborted(), is(false));
}

public void testInputStreamGetMetadata() throws IOException {
final byte[] expectedBytes = randomByteArrayOfLength(randomIntBetween(1, 512));

final S3RetryingInputStream stream = createInputStream(expectedBytes, 0L, (long) (Integer.MAX_VALUE - 1));

Map<String, String> metadata = new HashMap<>();
assertEquals(stream.getMetadata(), metadata);
}

public void testInputStreamIsAborted() throws IOException {
final byte[] expectedBytes = randomByteArrayOfLength(randomIntBetween(10, 512));
final byte[] actualBytes = new byte[randomIntBetween(1, Math.max(1, expectedBytes.length - 1))];
Expand Down

0 comments on commit 8247c56

Please sign in to comment.