Skip to content

Commit 36bd137

Browse files
committed
DefaultOpDescriptionGeneratorTest: add docs
1 parent 469cb40 commit 36bd137

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

scijava-ops-engine/src/test/java/org/scijava/ops/engine/impl/DefaultOpDescriptionGeneratorTest.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
import java.util.List;
1515
import java.util.function.Function;
1616

17+
/**
18+
* Tests basic behavior of {@link DefaultOpDescriptionGenerator}.
19+
*
20+
* @author Gabriel Selzer
21+
*/
1722
public class DefaultOpDescriptionGeneratorTest extends AbstractTestEnvironment
1823
implements OpCollection
1924
{
@@ -44,6 +49,11 @@ public static void addNeededOps() {
4449
in1.add(in2);
4550
};
4651

52+
/**
53+
* Tests that, when multiple Ops declare the same number of parameters, and
54+
* when each corresponding parameter index is described in the same way, that
55+
* the two Ops are coalesced into one entry in the help message.
56+
*/
4757
@Test
4858
public void testCoalescedDescriptions() {
4959
String actual = ops.unary("test.coalesceDescription").helpVerbose();
@@ -55,20 +65,18 @@ public void testCoalescedDescriptions() {
5565
"\t\t> input1 : java.lang.Double\n" + "\t\tReturns : java.lang.Double\n" +
5666
"\t- org.scijava.ops.engine.impl.DefaultOpDescriptionGeneratorTest$func2\n" +
5767
"\t\t> input1 : java.lang.Long\n" + "\t\tReturns : java.lang.Long";
58-
68+
// Assert that helpVerbose returns three entries
5969
Assertions.assertEquals(expected, actual);
60-
70+
// But assert that only two entries are seen for help
6171
actual = ops.unary("test.coalesceDescription").help();
6272
expected = //
6373
"test.coalesceDescription:\n\t- (list<number>, @CONTAINER list<number>) -> None\n\t- (number) -> number";
6474
Assertions.assertEquals(expected, actual);
65-
6675
// Test that with 2 inputs we do get the binary inplace Op, but no others
6776
actual = ops.binary("test.coalesceDescription").help();
6877
expected = //
6978
"test.coalesceDescription:\n\t- (@MUTABLE list<number>, number) -> None";
7079
Assertions.assertEquals(expected, actual);
71-
7280
// Finally test that with no inputs we don't get any of the Ops
7381
actual = ops.nullary("test.coalesceDescription").help();
7482
expected = "No Ops found matching this request.";

0 commit comments

Comments
 (0)