-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1236 from joelpramos/additional_change_for_1225
Fix for issue #1225 (error printing in memory JVM classes) and additi…
- Loading branch information
Showing
5 changed files
with
97 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
karate-core/src/test/java/com/intuit/karate/core/caller-with-lambda-arg.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@ignore | ||
Feature: | ||
|
||
Background: | ||
* def dataFunc = | ||
""" | ||
function() { | ||
var element = { | ||
"something": "value" | ||
}; | ||
var intBinaryOperator = Java.type('java.util.function.IntBinaryOperator'); | ||
var plusOperation = Java.extend(intBinaryOperator, { | ||
applyAsInt: function(left, right) { | ||
return left + right; | ||
} | ||
}); | ||
var featureResultTestClass = Java.type('com.intuit.karate.core.FeatureResultTest'); | ||
featureResultTestClass.addLambdaFunctionToMap(element); | ||
element.sum = new plusOperation(); | ||
return element; | ||
} | ||
""" | ||
* def elem = dataFunc() | ||
* def data = [ "#(elem)" ] | ||
|
||
Scenario: | ||
# ensuring the called.feature returns success | ||
# passing data with a functional interface should be correctly printed | ||
# in Result obj | ||
* def input = 3 | ||
* def result = call read('called.feature') data | ||
* match data[0].something == "value" | ||
* match data[0].javaSum(1,3) == 4 | ||
* match data[0].sum(1,3) == 4 | ||
|
||
* def left = 1 | ||
* def right = 2 | ||
* def payload = { "leftSide": #(left), "rightSide": #(right), "sum": '#(data[0].sum(left, right))' } | ||
* match payload == { "leftSide": 1, "rightSide": 2, "sum": '#? _ == 1+2' } | ||
* match payload == { "leftSide": 1, "rightSide": 2, "sum": '#? _ == data[0].sum( $.leftSide, $.rightSide)' } | ||
|