From f0c5b97915c47657b724659adeb9584052c8d433 Mon Sep 17 00:00:00 2001 From: Juan Toledo Date: Mon, 21 Aug 2017 16:48:27 +0200 Subject: [PATCH] Added new tests to confirm that longs are not properly handled with multiplemethods --- tests/java-src/org/jnius/MultipleMethods.java | 4 ++++ tests/test_basics.py | 2 ++ tests/test_method_multiple_signatures.py | 14 ++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/tests/java-src/org/jnius/MultipleMethods.java b/tests/java-src/org/jnius/MultipleMethods.java index 982a22f..6216154 100644 --- a/tests/java-src/org/jnius/MultipleMethods.java +++ b/tests/java-src/org/jnius/MultipleMethods.java @@ -29,4 +29,8 @@ public class MultipleMethods { public static String resolve(int... integers) { return "resolved varargs"; } + + public static String resolve(int i, long j, String k) { + return "resolved one int, one long and a string"; + } } diff --git a/tests/test_basics.py b/tests/test_basics.py index d6a5fb8..32f4a98 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -101,6 +101,8 @@ class BasicsTest(unittest.TestCase): test = autoclass('org.jnius.BasicsTest')() self.assertEquals(test.methodParamsZBCSIJFD( True, 127, 'k', 32767, 2147483467, 9223372036854775807, 1.23456789, 1.23456789), True) + self.assertEquals(test.methodParamsZBCSIJFD( + True, 127L, 'k', 32767L, 2147483467L, 9223372036854775807, 1.23456789, 1.23456789), True) self.assertEquals(test.methodParamsString('helloworld'), True) self.assertEquals(test.methodParamsArrayI([1, 2, 3]), True) self.assertEquals(test.methodParamsArrayString([ diff --git a/tests/test_method_multiple_signatures.py b/tests/test_method_multiple_signatures.py index 3e4266f..2e03903 100644 --- a/tests/test_method_multiple_signatures.py +++ b/tests/test_method_multiple_signatures.py @@ -44,6 +44,20 @@ class MultipleSignature(unittest.TestCase): MultipleMethods = autoclass('org.jnius.MultipleMethods') self.assertEqual(MultipleMethods.resolve(1, 2, 3), 'resolved varargs') + def test_multiple_methods_varargs_long(self): + MultipleMethods = autoclass('org.jnius.MultipleMethods') + self.assertEqual(MultipleMethods.resolve(1L, 2L, 3L), 'resolved varargs') + def test_multiple_methods_two_args_and_varargs(self): MultipleMethods = autoclass('org.jnius.MultipleMethods') self.assertEqual(MultipleMethods.resolve('one', 'two', 1, 2, 3), 'resolved two args and varargs') + + def test_multiple_methods_one_int_one_small_long_and_a_string(self): + MultipleMethods = autoclass('org.jnius.MultipleMethods') + self.assertEqual(MultipleMethods.resolve( + 1, 1L, "one"), "resolved one int, one long and a string") + + def test_multiple_methods_one_int_one_actual_long_and_a_string(self): + MultipleMethods = autoclass('org.jnius.MultipleMethods') + self.assertEqual(MultipleMethods.resolve( + 1, 2 ** 63 - 1, "one"), "resolved one int, one long and a string") \ No newline at end of file