Skip to content

Commit 28ca918

Browse files
committed
Added a new test for writeChars
1 parent 17e3b46 commit 28ca918

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class ClassWithEnum implements Serializable {
2121
/**
22-
*
22+
*
2323
*/
2424
private static final long serialVersionUID = 1L;
2525
public Color color = Color.GREEN;
@@ -48,13 +48,13 @@ class MyExceptionWhenDumping implements java.io.Serializable {
4848
protected static class MyException extends java.io.IOException {
4949

5050
/**
51-
*
51+
*
5252
*/
5353
private static final long serialVersionUID = 1L;
5454
}
5555

5656
/**
57-
*
57+
*
5858
*/
5959
private static final long serialVersionUID = 1L;;
6060

@@ -86,7 +86,7 @@ public static class A1 implements Serializable {
8686

8787
public static class B1 implements Serializable {
8888
/**
89-
*
89+
*
9090
*/
9191
private static final long serialVersionUID = 1L;
9292
Hashtable<Object, Object> h = new Hashtable<Object, Object>();
@@ -96,7 +96,7 @@ public static class B1 implements Serializable {
9696
public class SerializableTestHelper implements Serializable {
9797

9898
/**
99-
*
99+
*
100100
*/
101101
private static final long serialVersionUID = 0x7F0941F5L;
102102

@@ -190,6 +190,12 @@ public void testChar() throws IOException {
190190
oos.close();
191191
}
192192

193+
@Test
194+
public void testChars() throws IOException {
195+
oos.writeChars("python-javaobj");
196+
oos.close();
197+
}
198+
193199
@Test
194200
public void testClass() throws Exception {
195201
oos.writeObject(String.class);
@@ -365,7 +371,7 @@ public void windowClosing(final WindowEvent e) {
365371
class SuperAaaa implements Serializable {
366372

367373
/**
368-
*
374+
*
369375
*/
370376
private static final long serialVersionUID = 1L;
371377
public boolean bool = true;
@@ -377,7 +383,7 @@ class SuperAaaa implements Serializable {
377383
class TestConcrete extends SuperAaaa implements Serializable {
378384

379385
/**
380-
*
386+
*
381387
*/
382388
private static final long serialVersionUID = 1L;
383389
public String childString = "Child!!";

tests/testChars.ser

34 Bytes
Binary file not shown.

tests/tests.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,19 @@ def test_char_rw(self):
122122
self.assertEqual(pobj, '\x00C')
123123
self._try_marshalling(jobj, pobj)
124124

125+
def test_chars_rw(self):
126+
"""
127+
Reads testChars.ser and checks the serialization process
128+
"""
129+
# Expected string as a UTF-16 string
130+
expected = "python-javaobj".encode("utf-16-be").decode("latin1")
131+
132+
jobj = self.read_file("testChars.ser")
133+
pobj = javaobj.loads(jobj)
134+
_logger.debug("Read char objects: %s", pobj)
135+
self.assertEqual(pobj, expected)
136+
self._try_marshalling(jobj, pobj)
137+
125138
def test_double_rw(self):
126139
"""
127140
Reads testDouble.ser and checks the serialization process

0 commit comments

Comments
 (0)