Skip to content

Commit 3f32655

Browse files
committed
Add comments to the DatasetTypeExtractorTest
1 parent f83e8d2 commit 3f32655

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

scijava-ops-legacy/src/test/java/org/scijava/legacy/types/DatasetTypeExtractorTest.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,25 @@ public class DatasetTypeExtractorTest {
5454
@Test
5555
public void testDatasetTypeExtractor() {
5656
// Create a TypeReifier
57+
// NB the use of Discoverer.all(ServiceLoader::load) finds no TypeExtractors
58+
// because the scijava-ops-legacy module does not use the TypeExtractor
59+
// interface. Thus it cannot actually reify anything.
5760
var reifier = new DefaultTypeReifier(Discoverer.all(ServiceLoader::load));
5861
// Create a Dataset
5962
var img = ArrayImgs.unsignedBytes(10, 10);
6063
var imgPlus = new ImgPlus<>(img);
6164
// NB we pass a null context to avoid a SciJava Common dependency
6265
var ds = new DefaultDataset(null, imgPlus);
6366
// Assert correct reification
64-
// NB without a dependency on scijava-ops-image we cannot reify
65-
// the ImgPlus, but asserting an ImgPlus is the reified type
66-
// is enough to unit test the TypeExtractor
67+
// NB The generic parameter will be an Any due to the emtpy TypeReifier
68+
// as described above.
6769
var actual = new DatasetTypeExtractor().reify(reifier, ds);
68-
var expected = Types.parameterize(ImgPlus.class, new Type[] { new Any() });
70+
var expected = Types.parameterize(ImgPlus.class, new Type[] { Any.class });
6971
Assertions.assertEquals(expected, actual);
72+
// NB In the below check, the generic parameter will be UnsignedByteType,
73+
// because the scijava-ops-engine module DOES use TypeExtractr, so it can
74+
// discover the implementations. The IterableTypeExtractor is likely the
75+
// concrete TypeExtractor utilized to get the UnsignedByteType!
7076
OpEnvironment env = OpEnvironment.build();
7177
actual = env.genericType(ds);
7278
expected = Types.parameterize(ImgPlus.class, new Type[] {

0 commit comments

Comments
 (0)