2929
3030package org .scijava .ops ;
3131import static org .junit .Assert .assertTrue ;
32+
3233import java .util .function .BiFunction ;
3334
3435import org .junit .Test ;
35- import org .scijava .param .ValidityException ;
36+ import org .scijava .core .Priority ;
37+ import org .scijava .ops .core .Op ;
38+ import org .scijava .ops .core .Source ;
3639import org .scijava .ops .types .Nil ;
40+ import org .scijava .param .Parameter ;
41+ import org .scijava .param .ValidityException ;
42+ import org .scijava .plugin .Plugin ;
43+ import org .scijava .struct .ItemIO ;
3744
3845public class OpPriorityTest extends AbstractTestEnvironment {
46+
47+ @ Plugin (type = Op .class , name = "test.priority" , priority = Priority .HIGH )
48+ @ Parameter (key = "result" , type = ItemIO .OUTPUT )
49+ private static final class testDouble implements Source <Number >{
50+ @ Override
51+ public Number create () {
52+ return new Double (0.0 );
53+ }
54+ }
55+
56+ @ Plugin (type = Op .class , name = "test.priority" , priority = Priority .LOW )
57+ @ Parameter (key = "result" , type = ItemIO .OUTPUT )
58+ private static final class testFloat implements Source <Number >{
59+ @ Override
60+ public Number create () {
61+ return new Float (0.0 );
62+ }
63+ }
64+
3965
4066 Nil <Double > nilDouble = new Nil <Double >() {
4167 };
@@ -52,4 +78,12 @@ public void testOpCollection() throws ValidityException {
5278 // The found op is assumed to come from the MathOpCollection
5379 assertTrue (divFunction .getClass ().getName ().contains ("MathOpCollection$$Lambda" ));
5480 }
81+
82+ @ Test
83+ public void testOpPriority () {
84+
85+ Source <Number > testFunc = ops ().findOp ("test.priority" , new Nil <Source <Number >>() {}, new Nil [] {}, new Nil <Number >() {});
86+ Number x = testFunc .create ();
87+ assertTrue (x instanceof Double );
88+ }
5589}
0 commit comments