In Karate, what is the advantage of wrapping a Java function in a JavaScript function?
问题 I can wrap a Java function like this: * def myJavaMethod = """ function() { var Utils = Java.type('Utils'); // use Number type in constructor var obj = new Utils(...); return obj.myJavaMethod(); } """ But why would I? I can use Java functions straight in the test scenarios, like this: Scenario: Test exec and error value * def Utils = Java.type('Utils'); * def ret = Utils.exec('echo "From Java" > /home/richard//karate-test/karate-0.9.6/out.txt'); * match read('out.txt') == "From Java\n"; *