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