forked from json-iterator/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestGenerics.java
More file actions
37 lines (29 loc) · 918 Bytes
/
TestGenerics.java
File metadata and controls
37 lines (29 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.jsoniter.output;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class TestGenerics extends TestCase {
static {
// JsonStream.setMode(EncodingMode.DYNAMIC_MODE);
}
private ByteArrayOutputStream baos;
private JsonStream stream;
public void setUp() {
baos = new ByteArrayOutputStream();
stream = new JsonStream(baos, 4096);
}
public interface TestObject6Interface<A> {
A getHello();
}
public static class TestObject6 implements TestObject6Interface<Integer> {
public Integer getHello() {
return 0;
}
}
public void test_inherited_getter_is_not_duplicate() throws IOException {
TestObject6 obj = new TestObject6();
stream.writeVal(obj);
stream.close();
assertEquals("{\"hello\":0}", baos.toString());
}
}