Search in sources :

Example 76 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method missingSuperInterface.

@Test
public void missingSuperInterface() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("interface Foo extends Bar| {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    QuickfixTestBuilder _assertNoResolutionLabels = this.builder.create("Foo.xtend", _builder).assertIssueCodes(Diagnostic.LINKING_DIAGNOSTIC, org.eclipse.xtend.core.validation.IssueCodes.INTERFACE_EXPECTED).assertResolutionLabelsSubset("Create Java interface \'Bar\'", "Create Xtend interface \'Bar\'", "Create local Xtend interface \'Bar\'").assertNoResolutionLabels("Create Java class \'Bar\'", "Create Xtend class \'Bar\'", "Create local Xtend class \'Bar\'");
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("interface Foo extends Bar {");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("interface Bar {");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _assertNoResolutionLabels.assertModelAfterQuickfix("Create local Xtend interface \'Bar\'", _builder_1);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Example 77 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method useObjectForUnknownParams.

@Test
public void useObjectForUnknownParams() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class Foo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def foo(int x) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("bar|(x,y)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    QuickfixTestBuilder _assertResolutionLabelsSubset = this.builder.create("Foo.xtend", _builder).assertFeatureCallLinkingIssue().assertResolutionLabelsSubset("Create method \'bar(int, Object)\'");
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("class Foo {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("def foo(int x) {");
    _builder_1.newLine();
    _builder_1.append("\t\t");
    _builder_1.append("bar(x,y)");
    _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(int i, Object object) {");
    _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();
    _assertResolutionLabelsSubset.assertModelAfterQuickfix(_builder_1);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Example 78 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method redundantModifiers_14.

@Test
public void redundantModifiers_14() {
    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("public d|ef 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("public override m() {}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _assertResolutionLabels.assertModelAfterQuickfix(_builder_1);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Example 79 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method missingMemberStaticOperationContext.

@Test
public void missingMemberStaticOperationContext() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class Foo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static 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 local variable \'bar\'", "Create static method \'bar()\'", "Create static method \'getBar()\'", "Create static field \'bar\'");
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("class Foo {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("def static 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("\t");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("def static getBar() {");
    _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 static method \'getBar()\'", _builder_1);
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("class Foo {");
    _builder_2.newLine();
    _builder_2.append("\t");
    _builder_2.append("def static foo() {");
    _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("\t");
    _builder_2.newLine();
    _builder_2.append("\t");
    _builder_2.append("def static bar() {");
    _builder_2.newLine();
    _builder_2.append("\t\t");
    _builder_2.append(QuickfixTest.defaultBody, "\t\t");
    _builder_2.newLineIfNotEmpty();
    _builder_2.append("\t");
    _builder_2.append("}");
    _builder_2.newLine();
    _builder_2.append("\t");
    _builder_2.newLine();
    _builder_2.append("}");
    _builder_2.newLine();
    QuickfixTestBuilder _assertModelAfterQuickfix_1 = _assertModelAfterQuickfix.assertModelAfterQuickfix("Create static method \'bar()\'", _builder_2);
    StringConcatenation _builder_3 = new StringConcatenation();
    _builder_3.append("class Foo {");
    _builder_3.newLine();
    _builder_3.append("\t");
    _builder_3.newLine();
    _builder_3.append("\t");
    _builder_3.append("static Object bar");
    _builder_3.newLine();
    _builder_3.append("\t");
    _builder_3.newLine();
    _builder_3.append("\t");
    _builder_3.append("def static 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("}");
    _builder_3.newLine();
    _assertModelAfterQuickfix_1.assertModelAfterQuickfix("Create static field \'bar\'", _builder_3);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Example 80 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method duplicateImport_0.

@Test
public void duplicateImport_0() {
    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.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.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.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.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _assertResolutionLabels.assertModelAfterQuickfix(_builder_1);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Aggregations

QuickfixTestBuilder (org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder)122 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)122 Test (org.junit.Test)122 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 XtextEditor (org.eclipse.xtext.ui.editor.XtextEditor)1