Bug 571310 - update tests for new lambda eval support

Update the FunctionalCaptureTest18 with all supported scenarios with
this fix. Add new debug tests to test the new support.

Change-Id: Iea00763c44b2fe0db14b02f304a279ddcd16c2a8
Signed-off-by: Gayan Perera <gayanper@gmail.com>
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/182821
Tested-by: JDT Bot <jdt-bot@eclipse.org>
Reviewed-by: Sarika Sinha <sarika.sinha@in.ibm.com>
diff --git a/org.eclipse.jdt.debug.tests/java8/Bug571310.java b/org.eclipse.jdt.debug.tests/java8/Bug571310.java
new file mode 100644
index 0000000..6d0329c
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/java8/Bug571310.java
@@ -0,0 +1,25 @@
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+public class Bug571310 {
+    public static void main(String[] args) {
+    	(new Bug571310()).run();
+    }
+    
+    public void run() {
+		Stream.of("2")
+		.map(f -> this.selfAppend(f) + ".0")
+		.map(f -> this.appendDollar(f) + "0")
+		.forEach(System.out::print);
+    }
+
+	public String selfAppend(String val) {
+		return val.concat(val);
+	}
+
+	private String appendDollar(String val) {
+		return "$".concat(val);
+	}
+
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.tests/java8/FunctionalCaptureTest18.java b/org.eclipse.jdt.debug.tests/java8/FunctionalCaptureTest18.java
index 1a35ce4..9dc34a2 100644
--- a/org.eclipse.jdt.debug.tests/java8/FunctionalCaptureTest18.java
+++ b/org.eclipse.jdt.debug.tests/java8/FunctionalCaptureTest18.java
@@ -114,13 +114,12 @@
 
 		/* Capture methods */
 		assertFunctionalExpression(s -> Integer.valueOf(s, 16), "0B", 11);
-		/* But not yet directlt on the instance */
 		assertFunctionalExpression(obj -> obj.publicMethod() + 7, this, 12);
 		assertFunctionalExpression(obj -> this.publicMethod() + 8, this, 13);
 		assertFunctionalExpression(obj -> publicMethod() + 8, this, 13);
-		assertFunctionalExpression(obj -> obj.privateMethod() + 8, this, 14);/* SKIP */
-		assertFunctionalExpression(obj -> this.privateMethod() + 9, this, 15);/* SKIP */
-		assertFunctionalExpression(obj -> privateMethod() + 9, this, 15);/* SKIP */
+		assertFunctionalExpression(obj -> obj.privateMethod() + 8, this, 14);
+		assertFunctionalExpression(obj -> this.privateMethod() + 9, this, 15);
+		assertFunctionalExpression(obj -> privateMethod() + 9, this, 15);
 
 		/* Constructor references */
 		assertFunctionalExpression(String::new, new char[] { 'a','b','c' }, "abc");
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index d8b5f63..685087a 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -497,6 +497,7 @@
 				cfgs.add(createLaunchConfiguration(jp, "Bug569413"));
 				cfgs.add(createLaunchConfiguration(jp, "Bug573589"));
 				cfgs.add(createLaunchConfiguration(jp, "Bug574395"));
+				cfgs.add(createLaunchConfiguration(jp, "Bug571310"));
 	    		loaded18 = true;
 	    		waitForBuild();
 	        }
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/LambdaExpressionEvalTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/LambdaExpressionEvalTest.java
index 21ab19a..b332795 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/LambdaExpressionEvalTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/LambdaExpressionEvalTest.java
@@ -84,6 +84,24 @@
 		}
 	}
 
+	public void testBug571310_EvalLambdaWithPublicMethodInvocation_ExpectSuccessfulEval() throws Exception {
+		debugWithBreakpoint("Bug571310", 12);
+		resume(javaThread);
+		IValue value = doEval(javaThread, "this.selfAppend(f) + \".00\"");
+
+		assertNotNull("value is null", value);
+		assertEquals("value is not 22.00", "22.00", value.getValueString());
+	}
+
+	public void testBug571310_EvalLambdaWithPrivateMethodInvocation_ExpectSuccessfulEval() throws Exception {
+		debugWithBreakpoint("Bug571310", 13);
+		resume(javaThread);
+		IValue value = doEval(javaThread, "this.appendDollar(f) + \"0\"");
+
+		assertNotNull("value is null", value);
+		assertEquals("value is not $22.00", "$22.00", value.getValueString());
+	}
+
 	private void debugWithBreakpoint(String testClass, int lineNumber) throws Exception {
 		createLineBreakpoint(lineNumber, testClass);
 		javaThread = launchToBreakpoint(testClass);