2015-05-01 21:57:22 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
from __future__ import division
|
|
|
|
from __future__ import absolute_import
|
2012-08-15 22:16:17 +00:00
|
|
|
import unittest
|
|
|
|
from jnius.reflect import autoclass
|
|
|
|
from jnius import cast
|
|
|
|
|
|
|
|
|
2019-12-03 01:19:51 +00:00
|
|
|
class MultipleSignatureTest(unittest.TestCase):
|
2012-08-15 22:16:17 +00:00
|
|
|
def test_multiple_constructors(self):
|
|
|
|
String = autoclass('java.lang.String')
|
|
|
|
s = String('hello world')
|
2020-04-03 21:48:26 +00:00
|
|
|
self.assertEqual(s.__javaclass__, 'java/lang/String')
|
2012-08-15 22:16:17 +00:00
|
|
|
o = cast('java.lang.Object', s)
|
2020-04-03 21:48:26 +00:00
|
|
|
self.assertEqual(o.__javaclass__, 'java/lang/Object')
|
2012-08-15 22:16:17 +00:00
|
|
|
|
2019-12-03 01:19:51 +00:00
|
|
|
def test_mmap_toString(self):
|
|
|
|
mapClass = autoclass('java.util.HashMap')
|
|
|
|
hmap = mapClass()
|
|
|
|
hmap.put("a", "1")
|
|
|
|
hmap.toString()
|
|
|
|
mmap = cast('java.util.Map', hmap)
|
|
|
|
mmap.toString()
|
|
|
|
mmap.getClass()
|