change signature: expand expr lambda to block lambda when exception should be caught; don't expand method ref to lambda when only unchecked exceptions were added (IDEA-152386)

This commit is contained in:
Anna.Kozlova
2016-04-28 11:39:38 +02:00
parent bb09d3c6f3
commit bebf4975e6
8 changed files with 124 additions and 4 deletions
@@ -15,10 +15,12 @@
*/
package com.intellij.codeInsight.daemon.lambda;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.PsiType;
import com.intellij.refactoring.ChangeSignatureBaseTest;
import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
import com.intellij.refactoring.changeSignature.ThrownExceptionInfo;
import com.intellij.testFramework.IdeaTestUtil;
public class ChangeSignatureTouchLambdaTest extends ChangeSignatureBaseTest {
@@ -38,8 +40,21 @@ public class ChangeSignatureTouchLambdaTest extends ChangeSignatureBaseTest {
doTest(null, null, null, new ParameterInfoImpl[] {new ParameterInfoImpl(-1, "b", PsiType.BOOLEAN, "false")}, new ThrownExceptionInfo[0], true);
}
public void testAddExceptionToCatchInOneLineLambda() throws Exception {
doTest(null, null, new String[] {"java.io.IOException"}, false);
}
public void testAddUncheckedExceptionInMethodRef() throws Exception {
doTest(null, null, new String[] {"java.lang.NullPointerException"}, false);
}
@Override
protected String getRelativePath() {
return "/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}