7474/**
7575 * Abstract base class for testing N5 functionality.
7676 * Subclasses are expected to provide a specific N5 implementation to be tested by defining the {@link #createN5Writer()} method.
77+ * <p>
78+ * This class does not create sharded datasets. Its tests generally call read/writeChunk, not read/writeBlock despite
79+ * test methods using the generic term "block".
7780 *
7881 * @author Stephan Saalfeld <saalfelds@janelia.hhmi.org>
7982 * @author Igor Pisarev <pisarevi@janelia.hhmi.org>
@@ -162,7 +165,7 @@ protected N5Writer createN5Writer(final String location) throws IOException, URI
162165 return createN5Writer (location , new GsonBuilder ());
163166 }
164167
165- /* Tests that overide this should enusre that the `N5Writer` created will remove its container on close() */
168+ /* Tests that override this should ensure that the `N5Writer` created will remove its container on close() */
166169 protected abstract N5Writer createN5Writer (String location , GsonBuilder gson ) throws IOException , URISyntaxException ;
167170
168171 protected N5Reader createN5Reader (final String location ) throws IOException , URISyntaxException {
@@ -243,6 +246,7 @@ public void testCreateDataset() {
243246 }
244247 assertArrayEquals (dimensions , info .getDimensions ());
245248 assertArrayEquals (blockSize , info .getBlockSize ());
249+ assertArrayEquals ("blockSize == chunkSize when not sharded" , blockSize , info .getChunkSize ());
246250 assertEquals (DataType .UINT64 , info .getDataType ());
247251 }
248252
@@ -254,8 +258,8 @@ public void testBlocksLargerThanDimensions() {
254258 final int [] largeBlockSize = new int []{5 , 7 , 10 };
255259
256260 try (final N5Writer n5 = createTempN5Writer ()) {
257- n5 . createDataset ( datasetName , smallDimensions , largeBlockSize , DataType . UINT8 , new RawCompression ());
258- final DatasetAttributes attributes = n5 . getDatasetAttributes ( datasetName );
261+ final DatasetAttributes attributes = n5 . createDataset (
262+ datasetName , smallDimensions , largeBlockSize , DataType . UINT8 , new RawCompression () );
259263
260264 // Create a block that is larger than the dataset dimensions
261265 final int numElements = largeBlockSize [0 ] * largeBlockSize [1 ] * largeBlockSize [2 ];
@@ -475,11 +479,9 @@ public void testWriteReadDoubleBlock() {
475479 }
476480
477481 @ Test
478- public void testWriteReadShard () {
479-
480- // test that writeShard behaves the same as writeBlock
481- // for unsharded datasets
482+ public void testReadChunkVsBlock () {
482483
484+ // test that readBlock behaves the same as readChunk for unsharded datasets
483485 for (final Compression compression : getCompressions ()) {
484486 try (final N5Writer n5 = createTempN5Writer ()) {
485487
@@ -489,18 +491,17 @@ public void testWriteReadShard() {
489491
490492 n5 .writeChunk (datasetName , attributes , dataBlock );
491493
492- // read with readShard
494+ // read with readBlock
493495 final DataBlock <?> loadedShard = n5 .readBlock (datasetName , attributes , 0 , 0 , 0 );
494496 assertArrayEquals (shortBlock , (short [])loadedShard .getData ());
495497
496- // read with readBlock
497- final DataBlock <?> loadedDataBlock = n5 .readBlock (datasetName , attributes , 0 , 0 , 0 );
498+ // read with readChunk
499+ final DataBlock <?> loadedDataBlock = n5 .readChunk (datasetName , attributes , 0 , 0 , 0 );
498500 assertArrayEquals (shortBlock , (short [])loadedDataBlock .getData ());
499501 }
500502 }
501503 }
502504
503-
504505 @ Test
505506 public void testMode1WriteReadByteBlock () {
506507
0 commit comments