private void testLegalStrictBinding(boolean dynamicallyTyped, Annotation... targetAnnotation) throws Exception { when(annotation.value()).thenReturn(AllArguments.Assignment.STRICT); when(stackManipulation.isValid()).thenReturn(true); when(source.getParameters()) .thenReturn(new ParameterList.Explicit.ForTypes(source, firstSourceType, secondSourceType)); when(source.isStatic()).thenReturn(false); when(targetType.isArray()).thenReturn(true); when(targetType.getComponentType()).thenReturn(componentType); when(componentType.getStackSize()).thenReturn(StackSize.SINGLE); when(target.getType()).thenReturn(targetType); when(target.getDeclaredAnnotations()) .thenReturn(new AnnotationList.ForLoadedAnnotations(targetAnnotation)); MethodDelegationBinder.ParameterBinding<?> parameterBinding = AllArguments.Binder.INSTANCE.bind( annotationDescription, source, target, implementationTarget, assigner); assertThat(parameterBinding.isValid(), is(true)); verify(source, atLeast(1)).getParameters(); verify(source, atLeast(1)).isStatic(); verify(target, atLeast(1)).getType(); verify(target, atLeast(1)).getDeclaredAnnotations(); verify(assigner).assign(firstSourceType, componentType, Assigner.Typing.of(dynamicallyTyped)); verify(assigner).assign(secondSourceType, componentType, Assigner.Typing.of(dynamicallyTyped)); verifyNoMoreInteractions(assigner); }
@Override public int hashCode() { return 31 * assigner.hashCode() + typing.hashCode(); }