use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method featureCallWithoutParentheses.
@Test
public void featureCallWithoutParentheses() {
this.builder.setSeverity(IssueCodes.OPERATION_WITHOUT_PARENTHESES, "error");
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("val foo = newArrayList|");
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertIssueCodes = this.builder.create("Foo.xtend", _builder).assertIssueCodes(IssueCodes.OPERATION_WITHOUT_PARENTHESES);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("Add parentheses");
QuickfixTestBuilder _assertResolutionLabels = _assertIssueCodes.assertResolutionLabels(_builder_1.toString());
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("class Foo {");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("val foo = newArrayList()");
_builder_2.newLine();
_builder_2.append("}");
_builder_2.newLine();
_assertResolutionLabels.assertModelAfterQuickfix(_builder_2);
}
use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method redundantModifiers_09.
@Test
public void redundantModifiers_09() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("package val f|inal a = 1");
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertIssueCodes(org.eclipse.xtend.core.validation.IssueCodes.REDUNDANT_MODIFIER).assertResolutionLabels("Remove the redundant modifier.");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class Foo {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("package val a = 1");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_assertResolutionLabels.assertModelAfterQuickfix(_builder_1);
}
use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method redundantModifiers_13.
@Test
public void redundantModifiers_13() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class A {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m(){}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class B extends A {");
_builder.newLine();
_builder.append("\t");
_builder.append("pub|lic def override m() {}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertIssueCodes(org.eclipse.xtend.core.validation.IssueCodes.REDUNDANT_MODIFIER).assertResolutionLabels("Remove the redundant modifier.");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class A {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def m(){}");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("class B extends A {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def override m() {}");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_assertResolutionLabels.assertModelAfterQuickfix(_builder_1);
}
use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method missingMemberWithAssigmentExplicitThis.
@Test
public void missingMemberWithAssigmentExplicitThis() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def foo() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("this.bar| = 0L");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertResolutionLabels("Create method \'setBar(long)\'", "Create field \'bar\'");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class Foo {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def foo() {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("this.bar = 0L");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def setBar(long l) {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append(QuickfixTest.defaultBody, "\t\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
QuickfixTestBuilder _assertModelAfterQuickfix = _assertResolutionLabels.assertModelAfterQuickfix("Create method \'setBar(long)\'", _builder_1);
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("class Foo {");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("long bar");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("def foo() {");
_builder_2.newLine();
_builder_2.append("\t\t");
_builder_2.append("this.bar = 0L");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("}");
_builder_2.newLine();
_builder_2.append("}");
_builder_2.newLine();
_assertModelAfterQuickfix.assertModelAfterQuickfix("Create field \'bar\'", _builder_2);
}
use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method testBug456803.
@Test
public void testBug456803() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package bar");
_builder.newLine();
_builder.append("class Outer {");
_builder.newLine();
_builder.append("\t");
_builder.append("static class Inner{}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
this._workbenchTestHelper.createFile("bar/Foo.xtend", _builder.toString());
NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
this._syncUtil.waitForBuild(_nullProgressMonitor);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package bar");
_builder_1.newLine();
_builder_1.append("class X {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("var Inner| inner");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
QuickfixTestBuilder _assertResolutionLabelsSubset = this.builder.create("bar/Bar.xtend", _builder_1).assertResolutionLabelsSubset("Import \'Inner\' (bar.Outer)");
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("package bar");
_builder_2.newLine();
_builder_2.newLine();
_builder_2.append("import bar.Outer.Inner");
_builder_2.newLine();
_builder_2.newLine();
_builder_2.append("class X {");
_builder_2.newLine();
_builder_2.append(" ");
_builder_2.append("var Inner inner");
_builder_2.newLine();
_builder_2.append("}");
_builder_2.newLine();
_assertResolutionLabelsSubset.assertModelAfterQuickfix("Import \'Inner\' (bar.Outer)", _builder_2);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations