Skip to content

Commit 541b112

Browse files
committed
Added test for an array of classes
1 parent c7f1811 commit 541b112

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

tests/java/src/test/java/OneTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,17 @@ public void test2DArray() throws IOException {
254254
oos.close();
255255
}
256256

257+
@Test
258+
public void testClassArray() throws IOException {
259+
Class<?>[] array = new Class<?>[] {
260+
Integer.class,
261+
ObjectOutputStream.class,
262+
Exception.class,
263+
};
264+
oos.writeObject(array);
265+
oos.close();
266+
}
267+
257268
@Test
258269
public void testJapan() throws IOException {
259270
String stateOfJapan = "日本国";

tests/testClassArray.ser

386 Bytes
Binary file not shown.

tests/test_v2.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,17 @@ def test_2d_array(self):
464464
pobj, [[1, 2, 3], [4, 5, 6],],
465465
)
466466

467+
def test_class_array(self):
468+
"""
469+
Tests the handling of an array of Class objects
470+
"""
471+
jobj = self.read_file("testClassArray.ser")
472+
pobj = javaobj.loads(jobj)
473+
_logger.debug(pobj)
474+
self.assertEqual(pobj[0].name, "java.lang.Integer")
475+
self.assertEqual(pobj[1].name, "java.io.ObjectOutputStream")
476+
self.assertEqual(pobj[2].name, "java.lang.Exception")
477+
467478
def test_enums(self):
468479
"""
469480
Tests the handling of "enum" types

0 commit comments

Comments
 (0)