|
5 | 5 |
|
6 | 6 | import org.junit.Assert; |
7 | 7 | import org.junit.Test; |
| 8 | +import org.scijava.Priority; |
| 9 | +import org.scijava.ops.function.Producer; |
| 10 | +import org.scijava.ops.matcher.OpClassInfo; |
| 11 | +import org.scijava.param.Parameter; |
| 12 | +import org.scijava.struct.ItemIO; |
8 | 13 | import org.scijava.types.GenericTyped; |
9 | 14 | import org.scijava.types.Nil; |
10 | 15 |
|
@@ -35,4 +40,31 @@ public void testBakeType() { |
35 | 40 | type); |
36 | 41 | } |
37 | 42 |
|
| 43 | + @Test |
| 44 | + public void testClassOpification() { |
| 45 | + OpInfo opifyOpInfo = ops.env().opify(OpifyOp.class); |
| 46 | + Assert.assertEquals(OpifyOp.class.getName(), opifyOpInfo.implementationName()); |
| 47 | + // assert default priority |
| 48 | + Assert.assertEquals(Priority.NORMAL, opifyOpInfo.priority(), 0.); |
| 49 | + } |
| 50 | + |
| 51 | + @Test |
| 52 | + public void testClassOpificationWithPriority() { |
| 53 | + OpInfo opifyOpInfo = ops.env().opify(OpifyOp.class, Priority.HIGH); |
| 54 | + Assert.assertEquals(OpifyOp.class.getName(), opifyOpInfo.implementationName()); |
| 55 | + // assert default priority |
| 56 | + Assert.assertEquals(Priority.HIGH, opifyOpInfo.priority(), 0.); |
| 57 | + } |
| 58 | + |
| 59 | +} |
| 60 | + |
| 61 | +// TODO: remove @Parameter annotation when it is no longer necessary |
| 62 | +@Parameter(key = "output", itemIO = ItemIO.OUTPUT) |
| 63 | +class OpifyOp implements Producer<String> { |
| 64 | + |
| 65 | + @Override |
| 66 | + public String create() { |
| 67 | + return "This Op tests opify!"; |
| 68 | + } |
| 69 | + |
38 | 70 | } |
0 commit comments