Skip to content

Commit 91d3044

Browse files
gselzerctruedenhinerm
committed
Turn on ImageJ Ops2 tests
They were not running because of the removal of JUnit Jupiter Engine from the pom. Once enabled, many of them failed. So there are a set of fixes here that result in passing tests: * Export net.imagej.ops2.types to org.scijava.types * getOpMethod fallback: For the purposes of parsing javadoc parameters, we need to obtain the Op (read: functional) method of the Class of interest. Sometimes, however, this Op method isn't in the Class of interest, instead living in a superclass (and superinterface?). We cannot throw an error when such an Op class is discovered; we should just parse the superclass (superinterface?) method instead. * Partition SciJava Ops ServiceLoader main/test * Fix tag type from plugin type * HACK: avoid NPEs when RichOp list null * Euler tests: correct the conforms tests * Replace IAE with DependencyMatchingException * Use candidate type over info type * Update the tubeness ground truth image for imglib2-algorithm 0.12.0; see also imagej/imagej-ops@ca5b449 Co-authored-by: Curtis Rueden <ctrueden@wisc.edu> Co-authored-by: Mark Hiner <hinerm@gmail.com>
1 parent b3350dd commit 91d3044

26 files changed

Lines changed: 662 additions & 151 deletions

File tree

imagej/imagej-ops2/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,13 @@
326326

327327
<!-- Test scope dependencies -->
328328
<dependency>
329-
<groupId>junit</groupId>
330-
<artifactId>junit</artifactId>
329+
<groupId>org.junit.jupiter</groupId>
330+
<artifactId>junit-jupiter-api</artifactId>
331331
<scope>test</scope>
332332
</dependency>
333333
<dependency>
334334
<groupId>org.junit.jupiter</groupId>
335-
<artifactId>junit-jupiter-api</artifactId>
335+
<artifactId>junit-jupiter-engine</artifactId>
336336
<scope>test</scope>
337337
</dependency>
338338
<dependency>

imagej/imagej-ops2/src/main/java/module-info.java

Lines changed: 113 additions & 113 deletions
Large diffs are not rendered by default.

imagej/imagej-ops2/src/test/java/net/imagej/ops2/coloc/kendallTau/KendallTauBRankTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030
package net.imagej.ops2.coloc.kendallTau;
3131

32-
import static org.junit.Assume.assumeTrue;
3332
import static org.junit.jupiter.api.Assertions.assertEquals;
3433
import static org.junit.jupiter.api.Assertions.assertTrue;
34+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
3535

3636
import java.util.Iterator;
3737
import java.util.concurrent.ExecutorService;

imagej/imagej-ops2/src/test/java/net/imagej/ops2/geom/geom3d/MeshFeatureTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
import org.junit.jupiter.api.BeforeAll;
4343
import org.junit.jupiter.api.Test;
44+
import org.scijava.ops.api.features.DependencyMatchingException;
4445

4546
public class MeshFeatureTests extends AbstractFeatureTest {
4647
private static final double EPSILON = 10e-12;
@@ -56,8 +57,8 @@ public static void setupBefore() {
5657
@Test
5758
public void boxivityMesh() {
5859
try {
59-
ops.op("geom.boxivity").input(mesh).apply();
60-
} catch (IllegalArgumentException e) {
60+
ops.op("geom.boxivity").input(mesh).outType(DoubleType.class).apply();
61+
} catch (DependencyMatchingException e) {
6162
// DefaultSmallestOrientedBoundingBox is not implemented.
6263
}
6364
}

imagej/imagej-ops2/src/test/java/net/imagej/ops2/geom/geom3d/QuickHull3DTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
import static org.junit.jupiter.api.Assertions.assertEquals;
3333
import static org.junit.jupiter.api.Assertions.assertTrue;
34-
import static org.junit.Assume.assumeTrue;
34+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
3535

3636
import java.util.Random;
3737

imagej/imagej-ops2/src/test/java/net/imagej/ops2/topology/eulerCharacteristic/EulerCharacteristic26NFloatingTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ public class EulerCharacteristic26NFloatingTest extends AbstractOpTest {
5151
public void testConforms() throws AssertionError {
5252
final Img<BitType> img = ArrayImgs.bits(3, 3);
5353

54+
final DoubleType result = new DoubleType();
5455
Assertions.assertThrows(IllegalArgumentException.class, () -> {
55-
ops.op("topology.eulerCharacteristic26NFloating").input(img).outType(
56-
Double.class).apply();
56+
ops.op("topology.eulerCharacteristic26NFloating").input(img).output(
57+
result).compute();
5758
});
5859
}
5960

imagej/imagej-ops2/src/test/java/net/imagej/ops2/topology/eulerCharacteristic/EulerCharacteristic26NTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ public class EulerCharacteristic26NTest extends AbstractOpTest {
5151
public void testConforms() throws AssertionError {
5252
final Img<BitType> img = ArrayImgs.bits(3, 3);
5353

54+
final DoubleType result = new DoubleType();
5455
Assertions.assertThrows(IllegalArgumentException.class, () -> {
55-
ops.op("topology.eulerCharacteristic26N").input(img).apply();
56+
ops.op("topology.eulerCharacteristic26N").input(img).output(result).compute();
5657
});
5758
}
5859

imagej/imagej-ops2/src/test/java/net/imagej/ops2/topology/eulerCharacteristic/EulerCorrectionTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ public class EulerCorrectionTest extends AbstractOpTest {
5151
public void testConforms() throws Exception {
5252
final Img<BitType> img = ArrayImgs.bits(3, 3);
5353

54+
final DoubleType result = new DoubleType();
5455
Assertions.assertThrows(IllegalArgumentException.class, () -> {
55-
ops.op("topology.eulerCorrection").input(img).apply();
56+
ops.op("topology.eulerCorrection").input(img).output(result).compute();
5657
});
5758
}
5859

Binary file not shown.

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<module>scijava/scijava-ops-api</module>
5656
<module>scijava/scijava-ops-engine</module>
5757
<module>scijava/scijava-ops-serviceloader</module>
58+
<module>scijava/scijava-ops-serviceloader-test</module>
5859
<module>scijava/scijava-ops-spi</module>
5960
<module>scijava/scijava-parse2</module>
6061
<module>scijava/scijava-persist</module>

0 commit comments

Comments
 (0)