Skip to content

Commit d4fb9c9

Browse files
gselzerctrueden
authored andcommitted
Format dependency string test to follow pattern
1 parent ef22352 commit d4fb9c9

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

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

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,20 @@ public void testDependencylessOpRecoveryFromString() {
246246
*/
247247
@Test
248248
public void testOpWithDependencyRecoveryFromString() {
249-
OpInfo info = singularInfoOfName("test.provenanceMapper");
250-
OpInfo dependency = singularInfoOfName("test.provenanceMapped");
251-
InfoChain depChain = new InfoChain(dependency);
252-
InfoChain chain = new InfoChain(info, Collections.singletonList(depChain));
253-
String signature = chain.signature();
254-
Nil<Function<Double[], Thing>> special = new Nil<>() {};
255-
@SuppressWarnings("unused")
256-
Function<Double[], Thing> actual = ops.opFromSignature(signature, special);
249+
// Get the Op
250+
Function<Double[], Thing> mapper = ops //
251+
.op("test.provenanceMapper") //
252+
.input(new Double[] {5.0, 10.0, 15.0}) //
253+
.outType(Thing.class) //
254+
.function();
255+
// Get the signature from the Op
256+
String signature = history.signatureOf(mapper);
257+
// Generate the Op from the signature and an Op type
258+
Nil<Function<Double, Thing>> specialType = new Nil<>() {};
259+
Function<Double, Thing> actual = ops //
260+
.opFromSignature(signature, specialType);
261+
// Assert Op similarity
262+
Assertions.assertTrue(wrappedOpEquality(mapper, actual));
257263
}
258264

259265
/**
@@ -379,14 +385,6 @@ public void testAdaptationWithDependencies() {
379385

380386
// -- Helper Methods -- //
381387

382-
private OpInfo singularInfoOfName(String name) {
383-
Iterator<OpInfo> infos = ops.infos(name).iterator();
384-
Assertions.assertTrue(infos.hasNext());
385-
OpInfo info = infos.next();
386-
Assertions.assertFalse(infos.hasNext());
387-
return info;
388-
}
389-
390388
/**
391389
* This method returns {@code true} iff:
392390
* <ol>

0 commit comments

Comments
 (0)