use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method memberFeatureCallWithoutParentheses.
@Test
public void memberFeatureCallWithoutParentheses() {
this.builder.setSeverity(IssueCodes.OPERATION_WITHOUT_PARENTHESES, "error");
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def int foo() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("this.foo|");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_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("def int foo() {");
_builder_2.newLine();
_builder_2.append("\t\t");
_builder_2.append("this.foo()");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("}");
_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 missingConstructorCallParentheses_2.
@Test
public void missingConstructorCallParentheses_2() {
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("new ArrayList|");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabelsSubset = this.builder.create("Foo.xtend", _builder).assertIssueCodes(Diagnostic.LINKING_DIAGNOSTIC).assertResolutionLabelsSubset("Import \'ArrayList\' (java.util)");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("import java.util.ArrayList");
_builder_1.newLine();
_builder_1.newLine();
_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("new ArrayList");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_assertResolutionLabelsSubset.assertModelAfterQuickfix("Import \'ArrayList\' (java.util)", _builder_1);
}
use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method missingTypeInstanceAccess.
@Test
public void missingTypeInstanceAccess() {
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("Collections|.sort");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabelsSubset = this.builder.create("Foo.xtend", _builder).assertTypeLiteralLinkingIssue().assertResolutionLabelsSubset("Import \'Collections\' (java.util)");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("import java.util.Collections");
_builder_1.newLine();
_builder_1.newLine();
_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("Collections.sort");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_assertResolutionLabelsSubset.assertModelAfterQuickfix(_builder_1);
}
use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method duplicateImport_5.
@Test
public void duplicateImport_5() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("import static java.lang.String.valueOf");
_builder.newLine();
_builder.append("import static java.lang.String.valueOf");
_builder.newLine();
_builder.append("import static java.la|ng.String.format");
_builder.newLine();
_builder.append("import static java.lang.String.*");
_builder.newLine();
_builder.append("import static java.lang.String.*");
_builder.newLine();
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("def foo() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("valueOf(1)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("def bar() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("copyValueOf(null as char[])");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertIssueCodes(IssueCodes.IMPORT_UNUSED).assertResolutionLabels("Organize imports");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("import static java.lang.String.*");
_builder_1.newLine();
_builder_1.append("import static java.lang.String.valueOf");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("class Foo {");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def foo() {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("valueOf(1)");
_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 bar() {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("copyValueOf(null as char[])");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_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 missingMember.
@Test
public void missingMember() {
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("bar|");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertFeatureCallLinkingIssue().assertResolutionLabels("Create field \'bar\'", "Create local variable \'bar\'", "Create method \'bar()\'", "Create method \'getBar()\'");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class Foo {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("Object bar");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def foo() {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("bar");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
QuickfixTestBuilder _assertModelAfterQuickfix = _assertResolutionLabels.assertModelAfterQuickfix("Create field \'bar\'", _builder_1);
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("class Foo {");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("def foo() {");
_builder_2.newLine();
_builder_2.append("\t\t");
_builder_2.append("val bar = null");
_builder_2.newLine();
_builder_2.append("\t\t");
_builder_2.append("bar");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("}");
_builder_2.newLine();
_builder_2.append("}");
_builder_2.newLine();
QuickfixTestBuilder _assertModelAfterQuickfix_1 = _assertModelAfterQuickfix.assertModelAfterQuickfix("Create local variable \'bar\'", _builder_2);
StringConcatenation _builder_3 = new StringConcatenation();
_builder_3.append("class Foo {");
_builder_3.newLine();
_builder_3.append("\t");
_builder_3.append("def foo() {");
_builder_3.newLine();
_builder_3.append("\t\t");
_builder_3.append("bar");
_builder_3.newLine();
_builder_3.append("\t");
_builder_3.append("}");
_builder_3.newLine();
_builder_3.append("\t");
_builder_3.newLine();
_builder_3.append("\t");
_builder_3.append("def bar() {");
_builder_3.newLine();
_builder_3.append("\t\t");
_builder_3.append(QuickfixTest.defaultBody, "\t\t");
_builder_3.newLineIfNotEmpty();
_builder_3.append("\t");
_builder_3.append("}");
_builder_3.newLine();
_builder_3.append("\t");
_builder_3.newLine();
_builder_3.append("}");
_builder_3.newLine();
QuickfixTestBuilder _assertModelAfterQuickfix_2 = _assertModelAfterQuickfix_1.assertModelAfterQuickfix("Create method \'bar()\'", _builder_3);
StringConcatenation _builder_4 = new StringConcatenation();
_builder_4.append("class Foo {");
_builder_4.newLine();
_builder_4.append("\t");
_builder_4.append("def foo() {");
_builder_4.newLine();
_builder_4.append("\t\t");
_builder_4.append("bar");
_builder_4.newLine();
_builder_4.append("\t");
_builder_4.append("}");
_builder_4.newLine();
_builder_4.append("\t");
_builder_4.newLine();
_builder_4.append("\t");
_builder_4.append("def getBar() {");
_builder_4.newLine();
_builder_4.append("\t\t");
_builder_4.append(QuickfixTest.defaultBody, "\t\t");
_builder_4.newLineIfNotEmpty();
_builder_4.append("\t");
_builder_4.append("}");
_builder_4.newLine();
_builder_4.append("\t");
_builder_4.newLine();
_builder_4.append("}");
_builder_4.newLine();
_assertModelAfterQuickfix_2.assertModelAfterQuickfix("Create method \'getBar()\'", _builder_4);
}
Aggregations