### Question:
SubclassImplementationTarget extends Implementation.Target.AbstractBase { public Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token) { return token.getName().equals(MethodDescription.CONSTRUCTOR_INTERNAL_NAME) ? invokeConstructor(token) : invokeMethod(token); } protected  SubclassImplementationTarget(TypeDescription instrumentedType,
                                           MethodGraph.Linked methodGraph,
                                           DefaultMethodInvocation defaultMethodInvocation,
                                           OriginTypeResolver originTypeResolver); Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token); TypeDefinition getOriginType();  }### Answer:
@Test public void testSuperTypeMethodIsInvokable() throws Exception { when(invokableMethod.isSpecializableFor(rawSuperClass)).thenReturn(true); Implementation.SpecialMethodInvocation specialMethodInvocation = makeImplementationTarget().invokeSuper(invokableToken); assertThat(specialMethodInvocation.isValid(), is(true)); assertThat(specialMethodInvocation.getMethodDescription(), is((MethodDescription) invokableMethod)); assertThat(specialMethodInvocation.getTypeDescription(), is(rawSuperClass)); MethodVisitor methodVisitor = mock(MethodVisitor.class); Implementation.Context implementationContext = mock(Implementation.Context.class); StackManipulation.Size size = specialMethodInvocation.apply(methodVisitor, implementationContext); verify(methodVisitor).visitMethodInsn(Opcodes.INVOKESPECIAL, BAR, FOO, QUX, false); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); assertThat(size.getSizeImpact(), is(0)); assertThat(size.getMaximalSize(), is(0)); }
@Test public void testNonSpecializableSuperClassMethodIsNotInvokable() throws Exception { when(invokableMethod.isSpecializableFor(rawSuperClass)).thenReturn(false); Implementation.SpecialMethodInvocation specialMethodInvocation = makeImplementationTarget().invokeSuper(invokableToken); assertThat(specialMethodInvocation.isValid(), is(false)); }
@Test public void testSuperConstructorIsInvokable() throws Exception { when(invokableMethod.isConstructor()).thenReturn(true); when(definedSuperClassConstructor.isSpecializableFor(rawSuperClass)).thenReturn(true); Implementation.SpecialMethodInvocation specialMethodInvocation = makeImplementationTarget().invokeSuper(superConstructorToken); assertThat(specialMethodInvocation.isValid(), is(true)); assertThat(specialMethodInvocation.getMethodDescription(), is((MethodDescription) superClassConstructor)); assertThat(specialMethodInvocation.getTypeDescription(), is(rawSuperClass)); MethodVisitor methodVisitor = mock(MethodVisitor.class); Implementation.Context implementationContext = mock(Implementation.Context.class); StackManipulation.Size size = specialMethodInvocation.apply(methodVisitor, implementationContext); verify(methodVisitor).visitMethodInsn(Opcodes.INVOKESPECIAL, BAR, QUX, BAZ, false); verifyNoMoreInteractions(methodVisitor); verifyZeroInteractions(implementationContext); assertThat(size.getSizeImpact(), is(0)); assertThat(size.getMaximalSize(), is(0)); }