@Test public void testTypeCreation() throws Exception { StackManipulation stackManipulation = TypeCreation.forType(typeDescription); assertThat(stackManipulation.isValid(), is(true)); StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext); assertThat(size.getSizeImpact(), is(1)); assertThat(size.getMaximalSize(), is(1)); verify(methodVisitor).visitTypeInsn(Opcodes.NEW, FOO); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); }
@Test public void testAddition() throws Exception { StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext); assertThat(size.getMaximalSize(), is(0)); assertThat(size.getSizeImpact(), is(-stackSize.getSize())); verify(methodVisitor).visitInsn(opcodes); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); }