Reputation: 13
I have a user defined java class with a static method, in a classpath directory under src/test/java
package com.latch.configPackage;
public class base64Tohex {
public static void converter(String[] args) {
String guid = "YxRfXk827kPgkmMUX15PNg==";
String hexString = Hex.encodeHexString(guid.getBytes());
System.out.println(hexString);
return hexString;
}
}
I am calling the java class and method within my karate feature file as below
* def doWork =
"""
function(val) {
var configPackage = Java.type('com.mycompany.configPackage.base64Tohex');
var gc = new configPackage();
return gc.converter();
}
"""
where com.mycompany is also the group id in. my pom file. When I run the karate feature file on my Visual Studio, I get an error as below
<<<<
org.graalvm.polyglot.PolyglotException: TypeError: Access to host class com.mycompany.genevaconfig.base64Tohex is not allowed or does not exist.
- <js>.:anonymous(Unnamed:2)
How do I fix this?
Upvotes: 1
Views: 28