Skip to content

Commit bbff91f

Browse files
Treiblesschorlegselzer
authored andcommitted
Refactor types test a little bit
1 parent d487932 commit bbff91f

1 file changed

Lines changed: 6 additions & 26 deletions

File tree

‎src/test/java/org/scijava/ops/util/TypesTest.java‎

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -837,12 +837,7 @@ public <T> void testSatisfiesMatchingT() {
837837
@Test
838838
public <I1, I2> void testSatisfiesIndirectTypeVariables() {
839839

840-
class NestedThingImplOK1 implements NestedThing<Double, Double> {
841-
@Override
842-
public Double apply(Double t) {
843-
// NB: No implementation needed.
844-
return null;
845-
}
840+
abstract class NestedThingImplOK1 implements NestedThing<Double, Double> {
846841
}
847842

848843
final Type[] param = new Type[]{new Nil<Function<I1, I2>>() {}.getType()};
@@ -857,28 +852,13 @@ public Double apply(Double t) {
857852
@Test
858853
public <I1, I2> void testSatisfiesUnboundedTypeVariables() {
859854

860-
class NestedThingImplOK1 implements Function<Iterable<Double>, Consumer<Double>> {
861-
@Override
862-
public Consumer<Double> apply(Iterable<Double> t) {
863-
// NB: No implementation needed.
864-
return null;
865-
}
855+
abstract class NestedThingImplOK1 implements Function<Iterable<Double>, Consumer<Double>> {
866856
}
867857

868-
class NestedThingImplOK2 implements Function<Iterable<Double>, Consumer<Integer>> {
869-
@Override
870-
public Consumer<Integer> apply(Iterable<Double> t) {
871-
// NB: No implementation needed.
872-
return null;
873-
}
858+
abstract class NestedThingImplOK2 implements Function<Iterable<Double>, Consumer<Integer>> {
874859
}
875860

876-
class NestedThingImplOK3 implements Function<Double, Consumer<Integer>> {
877-
@Override
878-
public Consumer<Integer> apply(Double t) {
879-
// NB: No implementation needed.
880-
return null;
881-
}
861+
abstract class NestedThingImplOK3 implements Function<Double, Consumer<Integer>> {
882862
}
883863

884864
final Type[] param = new Type[]{new Nil<Function<I1, I2>>() {}.getType()};
@@ -888,8 +868,8 @@ public Consumer<Integer> apply(Double t) {
888868
argOK = new Type[]{NestedThingImplOK2.class};
889869
assertEquals(-1, Types.satisfies(argOK, param));
890870

891-
final Type[] argNotOK = new Type[]{NestedThingImplOK3.class};
892-
assertEquals(-1, Types.satisfies(argNotOK, param));
871+
argOK = new Type[]{NestedThingImplOK3.class};
872+
assertEquals(-1, Types.satisfies(argOK, param));
893873
}
894874

895875
/** Tests {@link Types#cast(Object, Class)}. */

0 commit comments

Comments
 (0)