Github user Claudenw commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/256#discussion_r106778971 --- Diff: src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java --- @@ -357,16 +369,23 @@ public void testInvokeMethod() throws Exception { assertEquals("foo(int)", MethodUtils.invokeMethod(testBean, "foo", NumberUtils.BYTE_ONE)); assertEquals("foo(double)", MethodUtils.invokeMethod(testBean, "foo", - NumberUtils.LONG_ONE)); - assertEquals("foo(double)", MethodUtils.invokeMethod(testBean, "foo", NumberUtils.DOUBLE_ONE)); assertEquals("foo(String...)", MethodUtils.invokeMethod(testBean, "foo", "a", "b", "c")); assertEquals("foo(String...)", MethodUtils.invokeMethod(testBean, "foo", "a", "b", "c")); assertEquals("foo(int, String...)", MethodUtils.invokeMethod(testBean, "foo", 5, "a", "b", "c")); - + assertEquals("foo(long...)", MethodUtils.invokeMethod(testBean, "foo", + 1L, 2L)); + + try { + MethodUtils.invokeMethod(testBean, "foo", + 1, 2); + fail("should throw NoSuchMethodException"); + } catch (final NoSuchMethodException e) { --- End diff -- I find that the expect exception works well only with very short tests. In this case if any of the earlier method calls throws the NoSuchMethodException the test will not fail. In my opinion the current construct is the better one.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---