use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method missingMember_02.
@Test
public void missingMember_02() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("static class Bar {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("def foo() {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("bar|");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_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.append("static class Bar {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("Object bar");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("def foo() {");
_builder_1.newLine();
_builder_1.append("\t\t\t");
_builder_1.append("bar");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_assertResolutionLabels.assertModelAfterQuickfix("Create field \'bar\'", _builder_1);
}
use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method missingMethodExplicitThis.
@Test
public void missingMethodExplicitThis() {
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|()");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertFeatureCallLinkingIssue().assertResolutionLabels("Create method \'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()");
_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(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();
_assertResolutionLabels.assertModelAfterQuickfix("Create method \'bar()\'", _builder_1);
}
use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method missingAnnotationImport.
@Test
public void missingAnnotationImport() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("@QuickFixMe|");
_builder.newLine();
_builder.append("class Foo {}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabelsSubset = this.builder.create("Foo.xtend", _builder).assertIssueCodes(Diagnostic.LINKING_DIAGNOSTIC).assertResolutionLabelsSubset("Import \'QuickFixMe\' (org.eclipse.xtend.ide.tests.data.quickfix)");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("import org.eclipse.xtend.ide.tests.data.quickfix.QuickFixMe");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("@QuickFixMe");
_builder_1.newLine();
_builder_1.append("class Foo {}");
_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 missingMemberSameClass.
@Test
public void missingMemberSameClass() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def foo(Foo foo) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("foo.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 method \'bar()\'", "Create field \'bar\'", "Create method \'getBar()\'");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class Foo {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def foo(Foo foo) {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("foo.bar");
_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(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 \'bar()\'", _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("Object bar");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("def foo(Foo foo) {");
_builder_2.newLine();
_builder_2.append("\t\t");
_builder_2.append("foo.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 field \'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(Foo foo) {");
_builder_3.newLine();
_builder_3.append("\t\t");
_builder_3.append("foo.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 getBar() {");
_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();
_assertModelAfterQuickfix_1.assertModelAfterQuickfix("Create method \'getBar()\'", _builder_3);
}
use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.
the class QuickfixTest method fixPackageName_5.
@Test
public void fixPackageName_5() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package bar|");
_builder.newLine();
_builder.newLine();
_builder.append("import static bar.C.D.*");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void m() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("staticM");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("static class D {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("static def void staticM() {}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertIssueCodes(org.eclipse.xtend.core.validation.IssueCodes.WRONG_PACKAGE).assertResolutionLabels("Change package declaration to \'\'");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("import static C.D.*");
_builder_1.newLine();
_builder_1.append("class Foo {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def void m() {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("staticM");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("class C {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("static class D {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("static def void staticM() {}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_assertResolutionLabels.assertModelAfterQuickfix(_builder_1);
}
Aggregations