### Question:
MethodDescriptor extends AbstractMethodDescriptor<Method> implements StaticExecutable { public Object invoke(Object object, Object... args) { try { return method.invoke(object, args); } catch (IllegalAccessException | InvocationTargetException e) { throw new ReflectionException(toString(), e); } } MethodDescriptor(TypeDescriptor declaringType, Method method); TypeDescriptor getReturnType(); Class<?> getRawReturnType(); List<ParameterDescriptor> getParameters(); int getParameterCount(); String getName(); List<Class<?>> getParameterTypes(); @Override Object invokeStatic(Object... args); Object invoke(Object object, Object... args); @Override boolean equals(Object obj); @Override int hashCode(); boolean applies(TypeDescriptor typeDescriptor); String toString(); @Override Method getElement();  }### Answer:
@Test public void invoke() { MyClass<Integer> myClass = new MyClass<>(); MethodDescriptor method = getMethodDescriptor(); @SuppressWarnings("unchecked") Set<Integer> result = (Set<Integer>) method.invoke(myClass, 123, new HashSet<>()); assertThat(result).isEqualTo(ImmutableSet.of(123)); }
@Test(expected = IllegalArgumentException.class) public void invoke_without_parameters() { MyClass<Integer> myClass = new MyClass<>(); getMethodDescriptor().invoke(myClass); }
@Test(expected = NullPointerException.class) public void invoke_without_object() { getMethodDescriptor().invoke(null, 123, new HashSet<>()); }