1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.yaml.snakeyaml.issues.issue50;
18
19 import junit.framework.TestCase;
20
21 import org.yaml.snakeyaml.Yaml;
22
23
24
25
26 public class SnakeyamlTest extends TestCase {
27 public static interface SomeBean {
28 String getAttribute1();
29
30 String getAttribute2();
31 }
32
33
34 private String attribute1;
35
36 public String getAttribute1() {
37 return attribute1;
38 }
39
40 public void setAttribute1(String attribute1) {
41 this.attribute1 = attribute1;
42 }
43 }
44
45 public static final class SomeBeanImpl extends BaseSomeBean {
46 private String attribute2;
47
48 public SomeBeanImpl(final String attribute1, final String attribute2) {
49 setAttribute1(attribute1);
50 setAttribute2(attribute2);
51 }
52
53 public String getAttribute2() {
54 return attribute2;
55 }
56
57 public void setAttribute2(String attribute2) {
58 this.attribute2 = attribute2;
59 }
60
61 @Override
62 public String toString() {
63 return "SomeBeanImpl";
64 }
65 }
66
67 public void testIntrospector() throws Exception {
68 SomeBean someBean = new SomeBeanImpl("value1", "value2");
69 Yaml dumper = new Yaml();
70 String output = dumper.dump(someBean);
71
72 assertEquals(
73 "!!org.yaml.snakeyaml.issues.issue50.SnakeyamlTest$SomeBeanImpl {attribute1: value1,\n attribute2: value2}\n",
74 output);
75 }
76 }