@Before
 public void setUp() throws Exception {
   when(methodDescription.getDeclaringType()).thenReturn(typeDescription);
   when(methodDescription.getReturnType()).thenReturn(returnType);
   when(methodDescription.getInternalName()).thenReturn(FOO);
   when(methodDescription.getDescriptor()).thenReturn(BAZ);
   when(typeDescription.getInternalName()).thenReturn(BAR);
   when(typeDescription.getDescriptor()).thenReturn(BAR);
   when(methodNameTransformer.transform(FOO)).thenReturn(QUX);
   when(otherMethodNameTransformer.transform(FOO)).thenReturn(FOO + BAR);
   when(parameterType.getStackSize()).thenReturn(StackSize.ZERO);
   ParameterList parameterList =
       ParameterList.Explicit.latent(methodDescription, Collections.singletonList(parameterType));
   when(methodDescription.getParameters()).thenReturn(parameterList);
 }
예제 #2
0
 /**
  * Transforms the given method into a stack manipulation that loads its type onto the operand
  * stack.
  *
  * @param methodDescription The method of which the method type should be loaded onto the operand
  *     stack.
  * @return A stack manipulation that loads the method type of the given method onto the operand
  *     stack.
  */
 public static StackManipulation of(MethodDescription methodDescription) {
   return new MethodTypeConstant(Type.getMethodType(methodDescription.getDescriptor()));
 }