### Question:
ReflectionHelper { public static void invokeTransformationMethod(Object mediator, Method method) { method = ReflectionHelper.makeAccessibleIfNot(method); List<Object> values = getParameterFromTransformationMethod(method); try { Class<?> returnType = method.getReturnType(); Outbound outbound = method.getAnnotation(Outbound.class); if (returnType.equals(Void.TYPE)) { method.invoke(mediator, values.toArray()); } else { if (outbound == null) { throw new IllegalStateException("The method " + method.getName() + " from " + mediator.getClass() + " needs to be annotated with @Outbound indicating the sink"); } else { Sink<Object> sink = getSinkOrFail(outbound.value()); Flowable<Object> flowable; if (Publisher.class.isAssignableFrom(returnType)) { flowable = Flowable.fromPublisher( (Publisher) method.invoke(mediator, values.toArray())); } else { throw new IllegalStateException("The method " + method.getName() + " from " + mediator.getClass() + " does not return a valid type"); } Type type = method.getGenericReturnType(); if (type instanceof ParameterizedType) { Type enclosed = ((ParameterizedType) type).getActualTypeArguments()[0]; if (!enclosed.getTypeName().startsWith(Message.class.getName())) { flowable.flatMapCompletable(sink::dispatch) .doOnError(Throwable::printStackTrace) .subscribe(); } else { flowable .flatMapCompletable(d -> sink.dispatch((Message) d)) .doOnError(Throwable::printStackTrace) .subscribe(); } } else { flowable.flatMapCompletable(sink::dispatch) .doOnError(Throwable::printStackTrace) .subscribe(); } } } } catch (Exception e) { throw new IllegalStateException("Unable to invoke " + method.getName() + " from " + mediator.getClass() .getName(), e); } } private  ReflectionHelper(); static void set(Object mediator, Field field, Object source); static void invokeFunction(Object mediator, Method method); static void invokeTransformationMethod(Object mediator, Method method); static Object getSourceToInject(Class<?> clazz, Type type, Source<Object> source); static void inject(Object mediator);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testTransformationWithNotAnnotatedParameter() throws NoSuchMethodException { InvalidBecauseOfBadParams test = new InvalidBecauseOfBadParams(); Method method = test.getClass().getMethod("trans", Source.class); ReflectionHelper.invokeTransformationMethod(test, method); }