### Question:
MethodCoercions { public static Maybe<?> tryFindAndInvokeBestMatchingMethod(final Object instance, final String methodName, final Object argument) { if (argument instanceof List) { List<?> arguments = (List<?>) argument; Maybe<?> maybe = tryFindAndInvokeMultiParameterMethod(instance, methodName, arguments); if (maybe.isAbsent()) maybe = tryFindAndInvokeSingleParameterMethod(instance, methodName, argument); return maybe; } else { return tryFindAndInvokeSingleParameterMethod(instance, methodName, argument); } }  static Predicate<Method> matchSingleParameterMethod(final String methodName, final Object argument); static Maybe<?> tryFindAndInvokeSingleParameterMethod(final Object instance, final String methodName, final Object argument); static Predicate<Method> matchMultiParameterMethod(final String methodName, final List<?> arguments); static Maybe<?> tryFindAndInvokeMultiParameterMethod(final Object instance, final String methodName, final List<?> arguments); static Maybe<?> tryFindAndInvokeBestMatchingMethod(final Object instance, final String methodName, final Object argument);  }### Answer:
@Test public void testTryFindAndInvokeBestMatchingMethod() throws Exception { TestClass instance = new TestClass(); Maybe<?> maybe = MethodCoercions.tryFindAndInvokeBestMatchingMethod(instance, "singleParameterMethod", "42"); assertTrue(maybe.isPresent()); assertTrue(instance.wasSingleParameterMethodCalled()); instance = new TestClass(); maybe = MethodCoercions.tryFindAndInvokeBestMatchingMethod(instance, "multiParameterMethod", ImmutableList.of("true", "42")); assertTrue(maybe.isPresent()); assertTrue(instance.wasMultiParameterMethodCalled()); instance = new TestClass(); maybe = MethodCoercions.tryFindAndInvokeBestMatchingMethod(instance, "singleCollectionParameterMethod", ImmutableList.of("fred", "joe")); assertTrue(maybe.isPresent()); assertTrue(instance.wasSingleCollectionParameterMethodCalled()); }