fix(bcmethod): make bcmethod abstract
This commit is contained in:
@@ -4,7 +4,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.tomatentum.cutin.method.BestCandidateMethod;
|
||||
import net.tomatentum.cutin.method.ReflectedMethod;
|
||||
|
||||
class ReflectedMethodTest {
|
||||
@@ -14,16 +13,16 @@ class ReflectedMethodTest {
|
||||
ReflectedMethod<String, String> method = new TestReflectedMethod(new TestMethodClass());
|
||||
Object result = method.run("testContext");
|
||||
assertTrue((boolean)result);
|
||||
System.out.println("Success");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBCMethod() {
|
||||
ReflectedMethod<String, Double> method = new BestCandidateMethod<String, Double>(
|
||||
ReflectedMethod<String, Double> method = new TestBestCandidateMethod(
|
||||
"test",
|
||||
new TestMethodClass(),
|
||||
"ident",
|
||||
"testString");
|
||||
new TestMethodClass());
|
||||
Object result = method.run((double)4);
|
||||
assertTrue((boolean)result);
|
||||
System.out.println("Success");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.tomatentum.cutin;
|
||||
|
||||
import net.tomatentum.cutin.method.BestCandidateMethod;
|
||||
|
||||
public class TestBestCandidateMethod extends BestCandidateMethod<String, Double> {
|
||||
|
||||
protected TestBestCandidateMethod(String methodName, Object containingObject) {
|
||||
super(methodName, containingObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getParameter(Double context, int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return context;
|
||||
case 1:
|
||||
return "testString";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String identifier() {
|
||||
return "ident";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,14 @@ public class TestReflectedMethod extends ReflectedMethod<String, String> {
|
||||
|
||||
@Override
|
||||
public Object getParameter(String context, int index) {
|
||||
return 2;
|
||||
switch (index) {
|
||||
case 0:
|
||||
return context;
|
||||
case 1:
|
||||
return 2;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user