@Test public void discoveresMethodParameterTypesCorrectly() throws Exception { TypeInformation<SecondExtension> information = ClassTypeInformation.from(SecondExtension.class); Method method = SecondExtension.class.getMethod("foo", Base.class); List<TypeInformation<?>> informations = information.getParameterTypes(method); TypeInformation<?> returnTypeInformation = information.getReturnType(method); assertThat(informations, hasSize(1)); assertThat(informations.get(0).getType(), is((Object) Base.class)); assertThat(informations.get(0), is((Object) returnTypeInformation)); }
@Test public void discoversImplementationBindingCorrectlyForNumber() throws Exception { TypeInformation<TypedClient> information = from(TypedClient.class); Method method = TypedClient.class.getMethod("boundToNumberMethod", GenericInterface.class); TypeInformation<?> parameterType = information.getParameterTypes(method).get(0); assertThat(parameterType.isAssignableFrom(from(StringImplementation.class)), is(false)); assertThat(parameterType.isAssignableFrom(from(LongImplementation.class)), is(true)); assertThat( parameterType.isAssignableFrom( from(StringImplementation.class).getSuperTypeInformation(GenericInterface.class)), is(false)); }