-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
155 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
scijava/scijava-ops-engine/src/test/java/org/scijava/ops/engine/impl/TherapiBasedOpTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package org.scijava.ops.engine.impl; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.scijava.function.Producer; | ||
import org.scijava.ops.engine.AbstractTestEnvironment; | ||
|
||
public class TherapiBasedOpTest extends AbstractTestEnvironment { | ||
|
||
private static final String FIELD_STRING = "This OpField is discoverable using Therapi!"; | ||
static final String CLASS_STRING = "This OpClass is discoverable using Therapi!"; | ||
private static final String METHOD_STRING = "This OpMethod is discoverable using Therapi!"; | ||
|
||
/** | ||
* @implNote op names='test.therapiOpField' | ||
*/ | ||
public final Producer<String> therapiFunction = () -> FIELD_STRING; | ||
|
||
@Test | ||
public void therapiOpFieldTest() { | ||
String actual = ops.op("test.therapiOpField").input().outType(String.class).create(); | ||
String expected = FIELD_STRING; | ||
Assert.assertEquals(expected, actual); | ||
} | ||
|
||
@Test | ||
public void therapiOpClassTest() { | ||
String actual = ops.op("test.therapiOpClass").input().outType(String.class).create(); | ||
String expected = CLASS_STRING; | ||
Assert.assertEquals(expected, actual); | ||
} | ||
|
||
@Test | ||
public void therapiOpMethodTest() { | ||
String actual = ops.op("test.therapiOpMethod").input().outType(String.class).create(); | ||
String expected = METHOD_STRING; | ||
Assert.assertEquals(expected, actual); | ||
} | ||
|
||
/** | ||
* @implNote op names='test.therapiOpMethod', | ||
* type='org.scijava.function.Producer' | ||
* @return a {@link String} | ||
*/ | ||
public static String therapiMethod() { | ||
return METHOD_STRING; | ||
} | ||
|
||
private static final String HIGH_PRIORITY_STRING = "High Priority"; | ||
private static final String LOW_PRIORITY_STRING = "Low Priority"; | ||
|
||
/** | ||
* @implNote op names='test.therapiPriority', priority='10.0' | ||
*/ | ||
public final Producer<String> therapiHighPriorityFunction = () -> HIGH_PRIORITY_STRING; | ||
|
||
/** | ||
* @implNote op names='test.therapiPriority', priority='1.0' | ||
*/ | ||
public final Producer<String> therapiLowPriorityFunction = () -> LOW_PRIORITY_STRING; | ||
|
||
@Test | ||
public void therapiOpFieldPriorityTest() { | ||
String actual = ops.op("test.therapiPriority").input().outType(String.class).create(); | ||
String expected = HIGH_PRIORITY_STRING; | ||
Assert.assertEquals(expected, actual); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* @implNote op names='test.therapiOpClass' | ||
*/ | ||
class TherapiOpClass implements Producer<String> { | ||
|
||
@Override | ||
public String create() { | ||
return TherapiBasedOpTest.CLASS_STRING; | ||
} | ||
|
||
} |