Hello,
I am trying to build a basic unit framework. I have got this method in a class called KUnit3
public static void checkEquals(double value1,double value2) {
if(value1 == value2) {
addToReport(String.format(" %f == %f", value1, value2));
passedChecks++;
} else {
addToReport(String.format("* %f == %f", value1, value2));
failedChecks++;
}
}
I have to access this method using Java reflection API from a class called 'TestASimpleClass' like for example
checkEquals(double value1, double value2)
Below is what I have done so far
public static void main(String[] args) throws Exception{
KunitTesting kunit = new KunitTesting();
ASimpleClass simple = new ASimpleClass();
Method [] method = kunit.getClass().getMethods();
for (Method m : method) {
if( m.getName().startsWith("check"))
{
m.setAccessible(true);
Method cE = kunit.getClass().getDeclaredMethod(m.getName(), double.class, double.class);
System.out.println(cE);
}
}
I am stuck after that. Can someone help me?
Thanks