[GitHub] commons-lang pull request #256: fix for LANG-1310
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/256 --- 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. ---
[GitHub] commons-lang pull request #256: fix for LANG-1310
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. ---
[GitHub] commons-lang pull request #256: fix for LANG-1310
Github user Abrasha commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/256#discussion_r106028522 --- 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 -- @PascalSchumacher what do you think about refactoring existing tests? Or it is fine to community? I can take care about it --- 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. ---
[GitHub] commons-lang pull request #256: fix for LANG-1310
Github user PascalSchumacher commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/256#discussion_r106023700 --- 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 -- In general I agree, but commons lang has a lot similar tests, so it's o.k/more consistent with existing code. --- 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. ---
[GitHub] commons-lang pull request #256: fix for LANG-1310
Github user Abrasha commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/256#discussion_r106018789 --- 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 -- Maybe it will be better to extract it to another test method with expected exception? ``` @Test(expected = NoSuchMethodException.class) public void methodName(){ } ``` --- 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. ---
[GitHub] commons-lang pull request #256: fix for LANG-1310
Github user jvz commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/256#discussion_r105941464 --- Diff: src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java --- @@ -110,32 +114,32 @@ private void privateStuff() { @SuppressWarnings("unused") private String privateStringStuff() { - return "privateStringStuff()"; + return "privateStringStuff()"; --- End diff -- Think you could fix the formatting here? --- 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. ---
[GitHub] commons-lang pull request #256: fix for LANG-1310
GitHub user drajakumar opened a pull request: https://github.com/apache/commons-lang/pull/256 fix for LANG-1310 You can merge this pull request into a Git repository by running: $ git pull https://github.com/drajakumar/commons-lang master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/256.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #256 --- 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. ---