use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.
the class AbstractRewritableImportSectionTest method testRemoveAddRemove.
@Test
public void testRemoveAddRemove() {
final RewritableImportSection section = this.getSection(List.class);
this.removeImport(section, List.class);
this.addImport(section, List.class);
this.removeImport(section, List.class);
StringConcatenation _builder = new StringConcatenation();
this.assertEquals(section, _builder);
}
use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.
the class AbstractRewritableImportSectionTest method testVariousAddAsString_3.
@Test
public void testVariousAddAsString_3() {
final RewritableImportSection section = this.getSection();
section.addStaticExtensionImport("com.google.common.base.Strings", "*");
section.addStaticImport("com.google.common.base.Strings", "*");
section.addStaticImport("com.google.common.base.Strings", "emptyToNull");
section.addImport("com.google.common.base.Strings");
StringConcatenation _builder = new StringConcatenation();
_builder.append("import static extension com.google.common.base.Strings.*");
_builder.newLine();
_builder.append("import com.google.common.base.Strings");
_builder.newLine();
this.assertEquals(section, _builder);
}
use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.
the class AbstractRewritableImportSectionTest method testAddNullMemberAsString.
@Test
public void testAddNullMemberAsString() {
final RewritableImportSection section = this.getSection(Set.class);
try {
section.addStaticImport("java.util.List", null);
Assert.fail();
} catch (final Throwable _t) {
if (_t instanceof IllegalArgumentException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
try {
section.addStaticExtensionImport("java.util.List", null);
Assert.fail();
} catch (final Throwable _t_1) {
if (_t_1 instanceof IllegalArgumentException) {
} else {
throw Exceptions.sneakyThrow(_t_1);
}
}
}
use of org.eclipse.xtext.xbase.imports.RewritableImportSection in project xtext-xtend by eclipse.
the class AbstractRewritableImportSectionTest method testDoubleAddAsString_6.
@Test
public void testDoubleAddAsString_6() {
final RewritableImportSection section = this.getSection(Collections.class);
section.addStaticExtensionImport("java.util.Collections", "*");
section.addStaticExtensionImport("java.util.Collections", "sort");
StringConcatenation _builder = new StringConcatenation();
_builder.append("import java.util.Collections");
_builder.newLine();
_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 testDoubleAddAsString.
@Test
public void testDoubleAddAsString() {
final RewritableImportSection section = this.getSection(List.class);
section.addImport("java.util.List");
section.addImport("java.util.List");
StringConcatenation _builder = new StringConcatenation();
_builder.append("import java.util.List");
_builder.newLine();
this.assertEquals(section, _builder);
}
Aggregations