json-tests: lambdafication & cleanup

This commit is contained in:
nik
2015-06-03 18:33:51 +03:00
parent aa4f8a4932
commit 03a9581a20
3 changed files with 9 additions and 17 deletions
@@ -16,13 +16,10 @@ public class JsonEditingTest extends JsonTestCase {
final String testName = "editing/" + getTestName(false);
myFixture.configureByFile(testName + ".json");
final int offset = myFixture.getEditor().getCaretModel().getOffset();
WriteCommandAction.runWriteCommandAction(null, new Computable<PsiFile>() {
@Override
public PsiFile compute() {
myFixture.getEditor().getCaretModel().moveToOffset(offset);
myFixture.type(characters);
return myFixture.getFile();
}
WriteCommandAction.runWriteCommandAction(null, (Computable<PsiFile>)() -> {
myFixture.getEditor().getCaretModel().moveToOffset(offset);
myFixture.type(characters);
return myFixture.getFile();
});
myFixture.checkResultByFile(testName + ".after.json");
}
@@ -59,14 +59,11 @@ public class JsonLiveTemplateTest extends JsonTestCase {
createJsonTemplate("foo", "foo", templateContent);
myFixture.configureByText(JsonFileType.INSTANCE, "foo<caret>");
final Editor editor = myFixture.getEditor();
WriteCommandAction.runWriteCommandAction(null, new Runnable() {
@Override
public void run() {
new ListTemplatesAction().actionPerformedImpl(getProject(), editor);
final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
assertNotNull(lookup);
lookup.finishLookup(Lookup.NORMAL_SELECT_CHAR);
}
WriteCommandAction.runWriteCommandAction(null, () -> {
new ListTemplatesAction().actionPerformedImpl(getProject(), editor);
final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
assertNotNull(lookup);
lookup.finishLookup(Lookup.NORMAL_SELECT_CHAR);
});
myFixture.checkResult(templateContent.replaceAll("\\$.*?\\$", ""));
}
@@ -19,8 +19,6 @@ public abstract class JsonTestCase extends LightCodeInsightFixtureTestCase {
Logger.setFactory(TestLoggerFactory.class);
}
protected static final Logger LOG = Logger.getInstance(JsonTestCase.class);
@Override
public void setUp() throws Exception {
PlatformTestCase.autodetectPlatformPrefix();