Skip to content

Commit 172009d

Browse files
authored
Merge pull request #289 from scijava/enhance-bytebanktest
ByteBankTest: Add test for the toByteArrayMethod
2 parents 5b10cf4 + 4a877a0 commit 172009d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/test/java/org/scijava/io/ByteBankTest.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
* %%
1010
* Redistribution and use in source and binary forms, with or without
1111
* modification, are permitted provided that the following conditions are met:
12-
*
12+
*
1313
* 1. Redistributions of source code must retain the above copyright notice,
1414
* this list of conditions and the following disclaimer.
1515
* 2. Redistributions in binary form must reproduce the above copyright notice,
1616
* this list of conditions and the following disclaimer in the documentation
1717
* and/or other materials provided with the distribution.
18-
*
18+
*
1919
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2020
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2121
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -68,6 +68,17 @@ public void testSetGetBytesArray() {
6868
assertEqualRead(testBytes.length - 4, 2);
6969
}
7070

71+
@Test
72+
public void testToByteArray() {
73+
// read in full array
74+
bank.setBytes(0l, testBytes.clone(), 0, testBytes.length);
75+
76+
assertArrayEquals(testBytes, bank.toByteArray());
77+
78+
byte[] actuals = bank.toByteArray(0, testBytes.length);
79+
assertArrayEquals(actuals, testBytes);
80+
}
81+
7182
@Test
7283
public void testSetGetBytesPartialArray() {
7384
// read in the partial array

0 commit comments

Comments
 (0)