Skip to content

Commit bd5d072

Browse files
committed
test: slice testing works on unmaterialized ReadData
* rename helper method * rm unused byte[]
1 parent c4c93b5 commit bd5d072

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

src/test/java/org/janelia/saalfeldlab/n5/readdata/ReadDataTests.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void testLazyReadData() throws IOException {
3535
assertTrue(readData instanceof LazyReadData);
3636

3737
readDataTestHelper(readData, N);
38-
splittableReadDataTestHelper(readData.materialize(), N);
38+
sliceTestHelper(readData, N);
3939
}
4040

4141
@Test
@@ -51,17 +51,13 @@ public void testByteArrayReadData() throws IOException {
5151

5252
readDataTestHelper(readData, N);
5353
readDataTestEncodeHelper(readData, N);
54-
splittableReadDataTestHelper(readData, N);
54+
sliceTestHelper(readData, N);
5555
}
5656

5757
@Test
5858
public void testInputStreamReadData() throws IOException {
5959

6060
final int N = 128;
61-
byte[] data = new byte[N];
62-
for( int i = 0; i < N; i++ )
63-
data[i] = (byte)i;
64-
6561
final InputStream is = new InputStream() {
6662
int val = 0;
6763
@Override
@@ -72,7 +68,7 @@ public int read() throws IOException {
7268

7369
final ReadData readData = ReadData.from(is, N);
7470
readDataTestHelper(readData, N);
75-
splittableReadDataTestHelper(readData.materialize(), N);
71+
sliceTestHelper(readData, N);
7672
}
7773

7874
@Test
@@ -93,7 +89,7 @@ public void testFileKvaReadData() throws IOException {
9389
.createReadData(tmpF.getAbsolutePath());
9490

9591
assertEquals("file read data length", 128, readData.length());
96-
splittableReadDataTestHelper(readData, N);
92+
sliceTestHelper(readData, N);
9793
}
9894

9995
private void readDataTestHelper( ReadData readData, int N ) throws IOException {
@@ -117,7 +113,7 @@ private void readDataTestEncodeHelper( ReadData readData, int N ) throws IOExcep
117113
assertArrayEquals(origCopy, encodedTwice.allBytes());
118114
}
119115

120-
private void splittableReadDataTestHelper( ReadData readData, int N ) throws IOException {
116+
private void sliceTestHelper( ReadData readData, int N ) throws IOException {
121117

122118
assertEquals("length one", 1, readData.slice(9, 1).length());
123119

0 commit comments

Comments
 (0)