|
@@ -11,7 +11,7 @@ import java.util.Map;
|
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
|
import java.util.function.Supplier;
|
|
import java.util.function.Supplier;
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
-import net.ranides.assira.junit.InterfaceTest;
|
|
|
|
|
|
|
+import net.ranides.assira.junit.TestContract;
|
|
|
import net.ranides.assira.junit.mockup.TesterObjects.*;
|
|
import net.ranides.assira.junit.mockup.TesterObjects.*;
|
|
|
import net.ranides.assira.junit.mockup.TesterInterfaces.*;
|
|
import net.ranides.assira.junit.mockup.TesterInterfaces.*;
|
|
|
import org.junit.Ignore;
|
|
import org.junit.Ignore;
|
|
@@ -25,7 +25,7 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class ForA1 {
|
|
public static class ForA1 {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void run(IntA object) {
|
|
public void run(IntA object) {
|
|
|
object.findFirst();
|
|
object.findFirst();
|
|
|
object.findAll();
|
|
object.findAll();
|
|
@@ -35,7 +35,7 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class ForA2 {
|
|
public static class ForA2 {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void exec(IntA object) {
|
|
public void exec(IntA object) {
|
|
|
TesterObjects.OUT.add("ForA2.exec");
|
|
TesterObjects.OUT.add("ForA2.exec");
|
|
|
}
|
|
}
|
|
@@ -44,17 +44,17 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class ForFunction {
|
|
public static class ForFunction {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void supplier(Supplier<List<String>> s) {
|
|
public void supplier(Supplier<List<String>> s) {
|
|
|
TesterObjects.OUT.add("ForFunction.supplier");
|
|
TesterObjects.OUT.add("ForFunction.supplier");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void function(Function<int[], List<String>> f) {
|
|
public void function(Function<int[], List<String>> f) {
|
|
|
TesterObjects.OUT.add("ForFunction.function");
|
|
TesterObjects.OUT.add("ForFunction.function");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void list(List<String> list) {
|
|
public void list(List<String> list) {
|
|
|
TesterObjects.OUT.add("ForFunction.list");
|
|
TesterObjects.OUT.add("ForFunction.list");
|
|
|
}
|
|
}
|
|
@@ -63,18 +63,18 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class ForSupport {
|
|
public static class ForSupport {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void run(IntA object) {
|
|
public void run(IntA object) {
|
|
|
object.findFirst();
|
|
object.findFirst();
|
|
|
object.findAll();
|
|
object.findAll();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void ignored(IntA object) {
|
|
public void ignored(IntA object) {
|
|
|
throw new NumberFormatException();
|
|
throw new NumberFormatException();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void otherMethod4Pattern(IntA object) {
|
|
public void otherMethod4Pattern(IntA object) {
|
|
|
throw new NumberFormatException();
|
|
throw new NumberFormatException();
|
|
|
}
|
|
}
|
|
@@ -83,13 +83,13 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class Invalid {
|
|
public static class Invalid {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void run(IntA object) {
|
|
public void run(IntA object) {
|
|
|
object.findFirst();
|
|
object.findFirst();
|
|
|
object.findAll();
|
|
object.findAll();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void other(IntA object, int params) {
|
|
public void other(IntA object, int params) {
|
|
|
object.findFirst();
|
|
object.findFirst();
|
|
|
object.findAll();
|
|
object.findAll();
|
|
@@ -99,14 +99,14 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class Correct {
|
|
public static class Correct {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void run(IntA object) {
|
|
public void run(IntA object) {
|
|
|
object.findFirst();
|
|
object.findFirst();
|
|
|
object.findAll();
|
|
object.findAll();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Ignore
|
|
@Ignore
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void other(IntA object, int params) {
|
|
public void other(IntA object, int params) {
|
|
|
object.findFirst();
|
|
object.findFirst();
|
|
|
object.findAll();
|
|
object.findAll();
|
|
@@ -116,12 +116,12 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class ForB {
|
|
public static class ForB {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void runO(IntB object) {
|
|
public void runO(IntB object) {
|
|
|
object.open();
|
|
object.open();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void runC(IntB object) {
|
|
public void runC(IntB object) {
|
|
|
object.close();
|
|
object.close();
|
|
|
}
|
|
}
|
|
@@ -130,17 +130,17 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class ForC {
|
|
public static class ForC {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void runR(IntC object) {
|
|
public void runR(IntC object) {
|
|
|
object.read();
|
|
object.read();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void runW(IntC object) {
|
|
public void runW(IntC object) {
|
|
|
object.write();
|
|
object.write();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void runZ(Supplier<IntC> function) {
|
|
public void runZ(Supplier<IntC> function) {
|
|
|
function.get().next();
|
|
function.get().next();
|
|
|
}
|
|
}
|
|
@@ -149,7 +149,7 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class ForAbstractAB {
|
|
public static class ForAbstractAB {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void exec(AbstractAB that) {
|
|
public void exec(AbstractAB that) {
|
|
|
TesterObjects.OUT.add("ForAbstractAB.exec");
|
|
TesterObjects.OUT.add("ForAbstractAB.exec");
|
|
|
}
|
|
}
|
|
@@ -158,7 +158,7 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class ForMap {
|
|
public static class ForMap {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void exec(Supplier<Map<Integer, String>> supplier) {
|
|
public void exec(Supplier<Map<Integer, String>> supplier) {
|
|
|
TesterObjects.OUT.add("map");
|
|
TesterObjects.OUT.add("map");
|
|
|
}
|
|
}
|
|
@@ -167,7 +167,7 @@ public class Testers {
|
|
|
|
|
|
|
|
public static class ForWildcard {
|
|
public static class ForWildcard {
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void wildcard(Supplier<? extends Map<Integer, String>> supplier) {
|
|
public void wildcard(Supplier<? extends Map<Integer, String>> supplier) {
|
|
|
TesterObjects.OUT.add("map");
|
|
TesterObjects.OUT.add("map");
|
|
|
}
|
|
}
|
|
@@ -182,7 +182,7 @@ public class Testers {
|
|
|
@Resource(name="count!")
|
|
@Resource(name="count!")
|
|
|
private int count;
|
|
private int count;
|
|
|
|
|
|
|
|
- @InterfaceTest
|
|
|
|
|
|
|
+ @TestContract
|
|
|
public void run(Object input) {
|
|
public void run(Object input) {
|
|
|
TesterObjects.OUT.add("n=" +name + " c="+count);
|
|
TesterObjects.OUT.add("n=" +name + " c="+count);
|
|
|
}
|
|
}
|