@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(expected = IllegalArgumentException.class) public void testTypeCreationAbstract() throws Exception { when(typeDescription.isAbstract()).thenReturn(true); TypeCreation.forType(typeDescription); }