use of spoon.test.invocations.testclasses.Bar in project spoon by INRIA.
the class InvocationTest method testTargetNullForStaticMethod.
@Test
public void testTargetNullForStaticMethod() throws Exception {
final Factory factory = build(Bar.class);
final CtClass<Bar> barClass = factory.Class().get(Bar.class);
final CtMethod<?> staticMethod = barClass.getMethodsByName("staticMethod").get(0);
final CtExecutableReference<?> reference = factory.Method().createReference(staticMethod);
try {
final CtInvocation<?> invocation = factory.Code().createInvocation(null, reference);
assertNull(invocation.getTarget());
} catch (NullPointerException e) {
fail();
}
}