use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.
the class AbstractRewritableImportSectionTest method testRemoveAdd_2.
@Test
public void testRemoveAdd_2() {
final RewritableImportSection section = this.getSection(List.class, Set.class);
this.removeImport(section, List.class);
this.addImport(section, List.class);
StringConcatenation _builder = new StringConcatenation();
_builder.append("import java.util.Set");
_builder.newLine();
_builder.append("import java.util.List");
_builder.newLine();
this.assertEquals(section, _builder);
}
use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.
the class ImplementSuperMemberAssistTest method testExistingStaticImport.
@Test
public void testExistingStaticImport() throws Exception {
ICompletionProposal[] proposals = newBuilder().append("import static java.util.Collection.*" + "class SpecialList extends java.util.ArrayList { removeAll").computeCompletionProposals();
assertEquals(1, proposals.length);
ImportOrganizingProposal proposal = (ImportOrganizingProposal) proposals[0];
ReplacingAppendable appendable = proposal.getAppendable();
RewritableImportSection importSection = appendable.getImportSection();
List<ReplaceRegion> imports = importSection.rewrite();
assertEquals(1, imports.size());
assertEquals("import java.util.Collection", imports.get(0).getText().trim());
}
use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.
the class AbstractRewritableImportSectionTest method testDoubleAddAsString_3.
@Test
public void testDoubleAddAsString_3() {
final RewritableImportSection section = this.getSection();
section.addStaticImport("java.util.Collections", "*");
section.addStaticImport("java.util.Collections", "*");
StringConcatenation _builder = new StringConcatenation();
_builder.append("import static java.util.Collections.*");
_builder.newLine();
this.assertEquals(section, _builder);
}
use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.
the class AbstractRewritableImportSectionTest method testDoubleAddAsString_2.
@Test
public void testDoubleAddAsString_2() {
final RewritableImportSection section = this.getSection();
section.addStaticExtensionImport("java.util.Collections", "*");
section.addStaticExtensionImport("java.util.Collections", "*");
StringConcatenation _builder = new StringConcatenation();
_builder.append("import static extension java.util.Collections.*");
_builder.newLine();
this.assertEquals(section, _builder);
}
use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.
the class AbstractRewritableImportSectionTest method testDoubleAdd_3.
@Test
public void testDoubleAdd_3() {
final RewritableImportSection section = this.getSection();
this.addStaticImport(section, Collections.class);
this.addStaticImport(section, Collections.class);
StringConcatenation _builder = new StringConcatenation();
_builder.append("import static java.util.Collections.*");
_builder.newLine();
this.assertEquals(section, _builder);
}
Aggregations