java-callgraph
Changes
src/test/resources/javacg/lambda.feature 40(+40 -0)
Details
src/test/resources/javacg/lambda.feature 40(+40 -0)
diff --git a/src/test/resources/javacg/lambda.feature b/src/test/resources/javacg/lambda.feature
index 14d8f3f..c651e95 100644
--- a/src/test/resources/javacg/lambda.feature
+++ b/src/test/resources/javacg/lambda.feature
@@ -35,3 +35,43 @@ Feature: Lambda
"""
M:LambdaTest:lambda$methodA$0() (M)LambdaTest:methodB()
"""
+
+ Scenario: Retrieve nested lambdas
+ Given I have the class "NestedLambdaTest" with code:
+ """
+ public class NestedLambdaTest {
+ public void methodA() {
+ Runner r = () -> {
+ Runner r2 = () -> {
+ Runner r3 = () -> methodB();
+ r3.run();
+ };
+ r2.run();
+ };
+ r.run();
+ }
+
+ public void methodB() {}
+ }
+ """
+ When I run the analyze
+ # Creation of r in methodA
+ Then the result should contain:
+ """
+ M:NestedLambdaTest:methodA() (D)Runner:run(NestedLambdaTest)
+ """
+ # Creation of r2 in r
+ And the result should contain:
+ """
+ M:NestedLambdaTest:lambda$methodA$2() (D)Runner:run(NestedLambdaTest)
+ """
+ # Creation of r3 in r2
+ And the result should contain:
+ """
+ M:NestedLambdaTest:lambda$lambda$methodA$2$1() (D)Runner:run(NestedLambdaTest)
+ """
+ # Call of methodB in r3
+ And the result should contain:
+ """
+ M:NestedLambdaTest:lambda$lambda$lambda$methodA$2$1$0() (M)NestedLambdaTest:methodB()
+ """