Java surrounders: if and not surrounder should be able to handle java.lang

.Boolean expressions
This commit is contained in:
Alexander Zolotov
2014-01-08 15:41:08 +11:00
parent d35b82798f
commit 2665a70fef
10 changed files with 115 additions and 12 deletions
@@ -0,0 +1,9 @@
class Test {
boolean foo() {
return null;
}
void bar() {
<selection>foo()</selection>
}
}
@@ -0,0 +1,11 @@
import java.lang.Boolean;
class Test {
Boolean foo() {
return null;
}
void bar() {
<selection>foo()</selection>
}
}
@@ -0,0 +1,13 @@
import java.lang.Boolean;
class Test {
Boolean foo() {
return null;
}
void bar() {
if (foo()) {
}
}
}
@@ -0,0 +1,11 @@
class Test {
boolean foo() {
return null;
}
void bar() {
if (foo()) {
}
}
}
@@ -0,0 +1,11 @@
import java.lang.Boolean;
class Test {
Boolean foo() {
return null;
}
void bar() {
<selection>foo()</selection>
}
}
@@ -0,0 +1,11 @@
import java.lang.Boolean;
class Test {
Boolean foo() {
return null;
}
void bar() {
!(foo())
}
}
@@ -130,6 +130,21 @@ public class JavaSurroundWithTest extends LightCodeInsightTestCase {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
doTest(getTestName(false), new JavaWithNullCheckSurrounder());
}
public void testSurroundExpressionWithIf() {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
doTest(getTestName(false), new JavaWithIfExpressionSurrounder());
}
public void testSurroundExpressionWithIfForBoxedBooleans() {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
doTest(getTestName(false), new JavaWithIfExpressionSurrounder());
}
public void testSurroundExpressionWithNotForBoxedBooleans() {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
doTest(getTestName(false), new JavaWithNotSurrounder());
}
private void doTest(@NotNull String fileName, final Surrounder surrounder) {
configureByFile(BASE_PATH + fileName + ".java");