Search in sources :

Example 11 with SpoonClassNotFoundException

use of spoon.support.SpoonClassNotFoundException in project spoon by INRIA.

the class TypeTest method testUnboxingTypeReference.

@Test
public void testUnboxingTypeReference() throws Exception {
    // contract: When you call CtTypeReference#unbox on a class which doesn't exist
    // in the spoon path, the method return the type reference itself.
    final Factory factory = createFactory();
    final CtTypeReference<Object> aReference = factory.Type().createReference("fr.inria.Spoon");
    try {
        final CtTypeReference<?> unbox = aReference.unbox();
        assertEquals(aReference, unbox);
    } catch (SpoonClassNotFoundException e) {
        fail("Should never throw a SpoonClassNotFoundException.");
    }
}
Also used : ModelUtils.createFactory(spoon.testing.utils.ModelUtils.createFactory) Factory(spoon.reflect.factory.Factory) SpoonClassNotFoundException(spoon.support.SpoonClassNotFoundException) Test(org.junit.Test)

Aggregations

SpoonClassNotFoundException (spoon.support.SpoonClassNotFoundException)11 CtTypeReference (spoon.reflect.reference.CtTypeReference)5 Test (org.junit.Test)4 CtType (spoon.reflect.declaration.CtType)4 Launcher (spoon.Launcher)3 CtClass (spoon.reflect.declaration.CtClass)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Factory (spoon.reflect.factory.Factory)2 CtScanner (spoon.reflect.visitor.CtScanner)2 ScanningMode (spoon.reflect.visitor.chain.ScanningMode)2 File (java.io.File)1 URLClassLoader (java.net.URLClassLoader)1 ArrayDeque (java.util.ArrayDeque)1 TypeDeclaration (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration)1 TypeReference (org.eclipse.jdt.internal.compiler.ast.TypeReference)1 FieldBinding (org.eclipse.jdt.internal.compiler.lookup.FieldBinding)1 ReferenceBinding (org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding)1 Environment (spoon.compiler.Environment)1 CtFieldAccess (spoon.reflect.code.CtFieldAccess)1