use of spoon.reflect.visitor.MinimalImportScanner in project spoon by INRIA.
the class ImportScannerTest method testTargetTypeNull.
@Test
public void testTargetTypeNull() throws Exception {
Launcher spoon = new Launcher();
Factory factory = spoon.createFactory();
CtFieldReference fieldRef = factory.createFieldReference();
fieldRef.setStatic(true);
ImportScanner importScanner = new MinimalImportScanner();
importScanner.computeImports(fieldRef);
Collection<CtImport> imports = importScanner.getAllImports();
assertEquals(0, imports.size());
}
use of spoon.reflect.visitor.MinimalImportScanner in project spoon by INRIA.
the class ImportScannerTest method testComputeMinimalImportsInClass.
@Test
public void testComputeMinimalImportsInClass() throws Exception {
String packageName = "spoon.test.testclasses";
String className = "SampleImportClass";
String qualifiedName = packageName + "." + className;
Factory aFactory = build(packageName, className).getFactory();
CtType<?> theClass = aFactory.Type().get(qualifiedName);
ImportScanner importContext = new MinimalImportScanner();
importContext.computeImports(theClass);
Collection<CtImport> imports = importContext.getAllImports();
assertTrue(imports.isEmpty());
}
Aggregations