@Test public void testMethodHandle() throws Exception { when(javaConstant.asConstantPoolValue()).thenReturn(FOO); StackManipulation stackManipulation = new JavaConstantValue(javaConstant); StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext); assertThat(size.getSizeImpact(), is(1)); assertThat(size.getMaximalSize(), is(1)); verify(javaConstant).asConstantPoolValue(); verifyNoMoreInteractions(javaConstant); verify(methodVisitor).visitLdcInsn(FOO); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); }
public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitLdcInsn(javaConstant.asConstantPoolValue()); return StackSize.SINGLE.toIncreasingSize(); }
JavaConstantValue implements StackManipulation { public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitLdcInsn(javaConstant.asConstantPoolValue()); return StackSize.SINGLE.toIncreasingSize(); } }
JavaConstantValue implements StackManipulation { public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitLdcInsn(javaConstant.asConstantPoolValue()); return StackSize.SINGLE.toIncreasingSize(); } JavaConstantValue(JavaConstant javaConstant); }
JavaConstantValue implements StackManipulation { public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitLdcInsn(javaConstant.asConstantPoolValue()); return StackSize.SINGLE.toIncreasingSize(); } JavaConstantValue(JavaConstant javaConstant); boolean isValid(); Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext); }
JavaConstantValue implements StackManipulation { public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) { methodVisitor.visitLdcInsn(javaConstant.asConstantPoolValue()); return StackSize.SINGLE.toIncreasingSize(); } JavaConstantValue(JavaConstant javaConstant); boolean isValid(); Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext);  }