1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.yaml.snakeyaml.issues.issue73;
17
18 import java.util.ArrayList;
19
20 import junit.framework.TestCase;
21
22 import org.yaml.snakeyaml.Yaml;
23
24
25
26
27
28 public class ArrayListTest extends TestCase {
29 public void testListImplementation() {
30 Bean1 bean = new Bean1();
31 bean.setId("ID123");
32 ArrayList<String> list = new ArrayList<String>(3);
33 list.add("zzz");
34 list.add("xxx");
35 list.add("ccc");
36 bean.setList(list);
37 Yaml yaml = new Yaml();
38 String doc = yaml.dump(bean);
39
40 Bean1 loaded = (Bean1) yaml.load(doc);
41 assertEquals(3, loaded.getList().size());
42 assertEquals(ArrayList.class, loaded.getList().getClass());
43 }
44
45 public static class Bean1 {
46 private ArrayList<String> list;
47 private String id;
48
49 public ArrayList<String> getList() {
50 return list;
51 }
52
53 public void setList(ArrayList<String> list) {
54 this.list = list;
55 }
56
57 public String getId() {
58 return id;
59 }
60
61 public void setId(String id) {
62 this.id = id;
63 }
64 }
65 }