MCPcopy Create free account
hub / github.com/amazon-ion/ion-java / checkBlob

Method checkBlob

src/test/java/com/amazon/ion/BlobTest.java:58–77  ·  view source on GitHub ↗
(int[] expectedBytes, IonBlob value)

Source from the content-addressed store, hash-verified

56
57
58 public void checkBlob(int[] expectedBytes, IonBlob value)
59 throws NullValueException, IOException
60 {
61 assertSame(IonType.BLOB, value.getType());
62
63 byte[] bytes = value.getBytes();
64 assertNotSame(expectedBytes, bytes);
65 assertEquals(expectedBytes.length, bytes.length);
66
67 InputStream in = value.newInputStream();
68 for (int i = 0; i < expectedBytes.length; i++)
69 {
70 String msg = "index " + i;
71 assertEquals(msg, (byte) expectedBytes[i], bytes[i]);
72 assertEquals(msg, expectedBytes[i], in.read());
73 }
74 assertEquals("should be at EOF", -1, in.read());
75 assertEquals("should be at EOF", -1, in.read());
76 assertEquals("should be at EOF", -1, in.read());
77 }
78
79 public void checkBlob(byte[] expectedBytes, IonBlob value)
80 throws NullValueException, IOException

Callers 2

modifyBlobMethod · 0.95
testBlobDataMethod · 0.95

Calls 8

printBase64Method · 0.95
getTypeMethod · 0.65
getBytesMethod · 0.65
newInputStreamMethod · 0.65
readMethod · 0.65
toStringMethod · 0.65
assertEqualsMethod · 0.45
oneValueMethod · 0.45

Tested by

no test coverage detected