Call 'invokeBox' with proper class instance (not try to find it via reflection)
This commit is contained in:
+1
-8
@@ -22,11 +22,8 @@ import java.lang.reflect.Method;
|
||||
|
||||
public class AbstractCodegenTestCaseOnAndroid extends TestCase {
|
||||
|
||||
protected void invokeBoxMethod(String filePath, String expectedResult) throws Exception {
|
||||
protected void invokeBoxMethod(Class clazz, String filePath, String expectedResult) throws Exception {
|
||||
try {
|
||||
String simpelName = filePath.substring(filePath.lastIndexOf("/") + 1);
|
||||
String packageName = filePath.replaceAll("\\\\|-|\\.|/", "_");
|
||||
Class clazz = Class.forName(packageName + "." + getPackageClassName(simpelName));
|
||||
Method method = clazz.getMethod("box");
|
||||
assertEquals(expectedResult, method.invoke(null));
|
||||
}
|
||||
@@ -34,8 +31,4 @@ public class AbstractCodegenTestCaseOnAndroid extends TestCase {
|
||||
throw new RuntimeException("File: " + filePath, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getPackageClassName(String fileName) {
|
||||
return Character.toUpperCase(fileName.charAt(0)) + fileName.substring(1).replaceAll("\\.kt", "Kt");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user