Simplify public API: Drop Dumper from tests
diff --git a/src/test/java/examples/jodatime/JodaTimeExampleTest.java b/src/test/java/examples/jodatime/JodaTimeExampleTest.java
index 0d9ee47..c413a47 100644
--- a/src/test/java/examples/jodatime/JodaTimeExampleTest.java
+++ b/src/test/java/examples/jodatime/JodaTimeExampleTest.java
@@ -22,8 +22,6 @@
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
-import org.yaml.snakeyaml.Dumper;
-import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
public class JodaTimeExampleTest extends TestCase {
@@ -31,7 +29,7 @@
public void testDump() throws IOException {
DateTime time = new DateTime(timestamp, DateTimeZone.UTC);
- Yaml yaml = new Yaml(new Dumper(new JodaTimeRepresenter(), new DumperOptions()));
+ Yaml yaml = new Yaml(new JodaTimeRepresenter());
String joda = yaml.dump(time);
String date = new Yaml().dump(new Date(timestamp));
assertEquals(date, joda);
diff --git a/src/test/java/examples/staticstate/StaticFieldsTest.java b/src/test/java/examples/staticstate/StaticFieldsTest.java
index 2ed0e10..30902e3 100644
--- a/src/test/java/examples/staticstate/StaticFieldsTest.java
+++ b/src/test/java/examples/staticstate/StaticFieldsTest.java
@@ -22,7 +22,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
@@ -60,7 +59,7 @@
bean.setAge(25);
JavaBeanWithStaticState.setType("Represent");
JavaBeanWithStaticState.color = "Black";
- Yaml yaml = new Yaml(new Dumper(new MyRepresenter(), new DumperOptions()));
+ Yaml yaml = new Yaml(new MyRepresenter(), new DumperOptions());
String output = yaml.dump(bean);
// System.out.println(output);
assertEquals(
diff --git a/src/test/java/examples/staticstate/StaticFieldsWrapperTest.java b/src/test/java/examples/staticstate/StaticFieldsWrapperTest.java
index abacda6..7a68a3f 100644
--- a/src/test/java/examples/staticstate/StaticFieldsWrapperTest.java
+++ b/src/test/java/examples/staticstate/StaticFieldsWrapperTest.java
@@ -18,7 +18,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.JavaBeanDumper;
import org.yaml.snakeyaml.JavaBeanLoader;
@@ -67,7 +66,7 @@
JavaBeanWithStaticState.color = "Violet";
Representer repr = new Representer();
repr.addClassTag(Wrapper.class, new Tag("!mybean"));
- Yaml yaml = new Yaml(new Dumper(repr, new DumperOptions()));
+ Yaml yaml = new Yaml(repr);
String output = yaml.dump(new Wrapper(bean));
// System.out.println(output);
assertEquals("!mybean {age: -47, color: Violet, name: Bahrack, type: Type3}\n", output);
diff --git a/src/test/java/org/yaml/snakeyaml/DumperOptionsTest.java b/src/test/java/org/yaml/snakeyaml/DumperOptionsTest.java
index c3e45e1..e02d073 100644
--- a/src/test/java/org/yaml/snakeyaml/DumperOptionsTest.java
+++ b/src/test/java/org/yaml/snakeyaml/DumperOptionsTest.java
@@ -348,8 +348,7 @@
DumperOptions options = new DumperOptions();
options.setIndent(4);
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
- Dumper dumper = new Dumper(representer, options);
- Yaml yaml = new Yaml(dumper);
+ Yaml yaml = new Yaml(representer, options);
List<Integer> list = new ArrayList<Integer>();
list.add(1);
list.add(2);
diff --git a/src/test/java/org/yaml/snakeyaml/DumperTest.java b/src/test/java/org/yaml/snakeyaml/DumperTest.java
index 6b1bf20..5587b73 100644
--- a/src/test/java/org/yaml/snakeyaml/DumperTest.java
+++ b/src/test/java/org/yaml/snakeyaml/DumperTest.java
@@ -95,4 +95,10 @@
public void write(char[] cbuf, int off, int len) throws IOException {
}
}
+
+ @SuppressWarnings("deprecation")
+ public void testDeprecated() {
+ Yaml yaml = new Yaml(new Dumper());
+ yaml.dump("aaa1234567890");
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/Example2_24Test.java b/src/test/java/org/yaml/snakeyaml/Example2_24Test.java
index 23b5911..9cfe35e 100644
--- a/src/test/java/org/yaml/snakeyaml/Example2_24Test.java
+++ b/src/test/java/org/yaml/snakeyaml/Example2_24Test.java
@@ -241,8 +241,7 @@
Yaml yaml = new Yaml(new MyConstructor());
Shape shape = (Shape) yaml.load(Util.getLocalResource("specification/example2_24.yaml"));
assertNotNull(shape);
- Dumper dumper = new Dumper(new MyRepresenter(), new DumperOptions());
- yaml = new Yaml(dumper);
+ yaml = new Yaml(new MyRepresenter());
String output = yaml.dump(shape);
String etalon = Util.getLocalResource("specification/example2_24_dumped.yaml");
assertEquals(etalon, output);
diff --git a/src/test/java/org/yaml/snakeyaml/Example2_27Test.java b/src/test/java/org/yaml/snakeyaml/Example2_27Test.java
index a02f736..bc5da97 100644
--- a/src/test/java/org/yaml/snakeyaml/Example2_27Test.java
+++ b/src/test/java/org/yaml/snakeyaml/Example2_27Test.java
@@ -37,8 +37,7 @@
assertNotNull(invoice);
Person billTo = invoice.billTo;
assertEquals("Dumars", billTo.family);
- Dumper dumper = new Dumper(new DumperOptions());
- yaml = new Yaml(dumper);
+ yaml = new Yaml();
String output = yaml.dump(invoice);
String etalon = Util.getLocalResource("specification/example2_27_dumped.yaml");
assertEquals(etalon, output);
diff --git a/src/test/java/org/yaml/snakeyaml/JavaBeanWithNullValuesTest.java b/src/test/java/org/yaml/snakeyaml/JavaBeanWithNullValuesTest.java
index 3840c0a..c4cc9de 100644
--- a/src/test/java/org/yaml/snakeyaml/JavaBeanWithNullValuesTest.java
+++ b/src/test/java/org/yaml/snakeyaml/JavaBeanWithNullValuesTest.java
@@ -77,7 +77,7 @@
options.setDefaultScalarStyle(DumperOptions.ScalarStyle.DOUBLE_QUOTED);
options.setExplicitStart(true);
options.setExplicitEnd(true);
- Yaml yaml = new Yaml(new Dumper(new CustomRepresenter(), options));
+ Yaml yaml = new Yaml(new CustomRepresenter(), options);
javaBeanWithNullValues.setBoolean1(null);
javaBeanWithNullValues.setDate(new Date(System.currentTimeMillis()));
javaBeanWithNullValues.setDouble1(1d);
@@ -103,7 +103,7 @@
options.setExplicitStart(true);
options.setExplicitEnd(true);
options.setExplicitRoot(Tag.MAP);
- Yaml yaml = new Yaml(new Dumper(new CustomRepresenter(), options));
+ Yaml yaml = new Yaml(new CustomRepresenter(), options);
javaBeanWithNullValues.setBoolean1(null);
javaBeanWithNullValues.setDate(new Date(System.currentTimeMillis()));
javaBeanWithNullValues.setDouble1(1d);
@@ -118,7 +118,7 @@
// System.out.println(dumpStr);
assertFalse("No explicit root tag must be used.", dumpStr
.contains("JavaBeanWithNullValues"));
- yaml = new Yaml(new Dumper(new CustomRepresenter(), options));
+ yaml = new Yaml(new CustomRepresenter(), options);
JavaBeanWithNullValues parsed = loader.load(dumpStr);
assertNull(" expect null, got " + parsed.getBoolean1(), parsed.getBoolean1());
assertNull(" expect null, got " + parsed.getString(), parsed.getString());
@@ -134,7 +134,7 @@
options.setDefaultScalarStyle(DumperOptions.ScalarStyle.DOUBLE_QUOTED);
options.setExplicitStart(true);
options.setExplicitEnd(true);
- Yaml yaml = new Yaml(new Dumper(new CustomRepresenter(), options));
+ Yaml yaml = new Yaml(new CustomRepresenter(), options);
if (nullValues) {
return yaml.dump(javaBeanWithNullValues);
}
diff --git a/src/test/java/org/yaml/snakeyaml/constructor/ClassTagsTest.java b/src/test/java/org/yaml/snakeyaml/constructor/ClassTagsTest.java
index 129e307..1052e25 100644
--- a/src/test/java/org/yaml/snakeyaml/constructor/ClassTagsTest.java
+++ b/src/test/java/org/yaml/snakeyaml/constructor/ClassTagsTest.java
@@ -22,8 +22,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
-import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.TypeDescription;
import org.yaml.snakeyaml.Util;
import org.yaml.snakeyaml.Yaml;
@@ -43,8 +41,7 @@
wheels.add(wheel);
}
car.setWheels(wheels);
- assertEquals(Util.getLocalResource("constructor/car-with-tags.yaml"), new Yaml()
- .dump(car));
+ assertEquals(Util.getLocalResource("constructor/car-with-tags.yaml"), new Yaml().dump(car));
}
public void testDumpClassTag() throws IOException {
@@ -60,8 +57,7 @@
Representer representer = new Representer();
representer.addClassTag(Car.class, new Tag("!car"));
representer.addClassTag(Wheel.class, Tag.MAP);
- Dumper dumper = new Dumper(representer, new DumperOptions());
- Yaml yaml = new Yaml(dumper);
+ Yaml yaml = new Yaml(representer);
String output = yaml.dump(car);
assertEquals(Util.getLocalResource("constructor/car-without-tags.yaml"), output);
}
diff --git a/src/test/java/org/yaml/snakeyaml/constructor/ImplicitTagsTest.java b/src/test/java/org/yaml/snakeyaml/constructor/ImplicitTagsTest.java
index 3a863c4..b74b5a6 100644
--- a/src/test/java/org/yaml/snakeyaml/constructor/ImplicitTagsTest.java
+++ b/src/test/java/org/yaml/snakeyaml/constructor/ImplicitTagsTest.java
@@ -23,7 +23,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.TypeDescription;
import org.yaml.snakeyaml.Util;
@@ -106,8 +105,7 @@
//
Representer representer = new Representer();
representer.addClassTag(Car.class, new Tag("!car"));
- Dumper dumper = new Dumper(representer, new DumperOptions());
- yaml = new Yaml(dumper);
+ yaml = new Yaml(representer);
String carYaml2 = yaml.dump(car);
assertEquals(Util.getLocalResource("constructor/car-without-tags.yaml"), carYaml2);
}
diff --git a/src/test/java/org/yaml/snakeyaml/constructor/TypeSafeCollectionsTest.java b/src/test/java/org/yaml/snakeyaml/constructor/TypeSafeCollectionsTest.java
index 6ce1e97..071db15 100644
--- a/src/test/java/org/yaml/snakeyaml/constructor/TypeSafeCollectionsTest.java
+++ b/src/test/java/org/yaml/snakeyaml/constructor/TypeSafeCollectionsTest.java
@@ -24,8 +24,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
-import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.JavaBeanLoader;
import org.yaml.snakeyaml.TypeDescription;
import org.yaml.snakeyaml.Util;
@@ -85,8 +83,7 @@
c.setWheels(wheels);
Representer representer = new Representer();
representer.addClassTag(MyWheel.class, Tag.MAP);
- Dumper dumper = new Dumper(representer, new DumperOptions());
- Yaml yaml = new Yaml(dumper);
+ Yaml yaml = new Yaml(representer);
String output = yaml.dump(c);
assertEquals(Util.getLocalResource("javabeans/mycar-with-global-tag1.yaml"), output);
// load
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/MoreImmutablesTest.java b/src/test/java/org/yaml/snakeyaml/immutable/MoreImmutablesTest.java
index 70c3fe9..2913cf9 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/MoreImmutablesTest.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/MoreImmutablesTest.java
@@ -25,14 +25,13 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
public class MoreImmutablesTest extends TestCase {
public void testInsets() {
- Yaml yaml = new Yaml(new Dumper(new ImmutablesRepresenter(), new DumperOptions()));
+ Yaml yaml = new Yaml(new ImmutablesRepresenter());
Insets insets = new Insets(10, 20, 30, 40);
String dump = yaml.dump(insets);
assertEquals("!!java.awt.Insets [10, 20, 30, 40]\n", dump);
@@ -41,7 +40,7 @@
}
public void testAwtColor() {
- Yaml yaml = new Yaml(new Dumper(new ImmutablesRepresenter(), new DumperOptions()));
+ Yaml yaml = new Yaml(new ImmutablesRepresenter());
Color color = new Color(10, 20, 30, 40);
String dump = yaml.dump(color);
assertEquals("!!java.awt.Color [10, 20, 30, 40]\n", dump);
@@ -50,7 +49,7 @@
}
public void testRectangle() {
- Yaml yaml = new Yaml(new Dumper(new ImmutablesRepresenter(), new DumperOptions()));
+ Yaml yaml = new Yaml(new ImmutablesRepresenter());
Rectangle rect = new Rectangle(10, 20, 30, 40);
String dump = yaml.dump(rect);
assertEquals("!!java.awt.Rectangle [10, 20, 30, 40]\n", dump);
@@ -62,7 +61,7 @@
public void testMatteBorder() {
DumperOptions options = new DumperOptions();
options.setWidth(400);
- Yaml yaml = new Yaml(new Dumper(new ImmutablesRepresenter(), options));
+ Yaml yaml = new Yaml(new ImmutablesRepresenter(), options);
Insets insets = new Insets(10, 20, 30, 40);
Color color = new Color(100, 150, 200);
MatteBorder border = BorderFactory.createMatteBorder(insets.top, insets.left,
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesTest.java b/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesTest.java
index c8cbf9c..08e76d4 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesTest.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesTest.java
@@ -18,16 +18,13 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
-import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
public class ImmutablePrimitivesTest extends TestCase {
public void testPrimitives() {
- Yaml yaml = new Yaml(new Dumper(new ImmutablePrimitivesRepresenter(),
- new DumperOptions()));
+ Yaml yaml = new Yaml(new ImmutablePrimitivesRepresenter());
BunchOfPrimitives bunch = new BunchOfPrimitives(10, 40.0, true);
String dump = yaml.dump(bunch);
assertEquals("!!" + bunch.getClass().getCanonicalName() + " [10, 40.0, true]\n", dump);
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue46/FileTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue46/FileTest.java
index f169c0b..4597f36 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue46/FileTest.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue46/FileTest.java
@@ -23,7 +23,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.Tag;
@@ -38,7 +37,7 @@
public void test() throws IOException {
File file = new File("src/test/resources/examples/list-bean-1.yaml");
assertTrue(file.exists());
- Yaml yaml = new Yaml(new Dumper(new MyRepresenter()));
+ Yaml yaml = new Yaml(new MyRepresenter());
Map<String, File> map = new HashMap<String, File>();
map.put("one", file);
String output = yaml.dump(map);
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue55/YamlFieldAccessCollectionTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue55/YamlFieldAccessCollectionTest.java
index ab2e818..de049ac 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue55/YamlFieldAccessCollectionTest.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue55/YamlFieldAccessCollectionTest.java
@@ -21,7 +21,6 @@
import org.junit.Assert;
import org.junit.Test;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.JavaBeanLoader;
import org.yaml.snakeyaml.Util;
@@ -72,8 +71,7 @@
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(FlowStyle.BLOCK);
options.setExplicitRoot(Tag.MAP);
- Dumper dumper = new Dumper(representer, options);
- Yaml yaml = new Yaml(dumper);
+ Yaml yaml = new Yaml(representer, options);
return yaml;
}
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue60/CustomOrderTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue60/CustomOrderTest.java
index a40ba89..88eb729 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue60/CustomOrderTest.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue60/CustomOrderTest.java
@@ -24,7 +24,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.Util;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.introspector.Property;
@@ -33,7 +32,7 @@
public class CustomOrderTest extends TestCase {
public void testReversedOrder() {
- Yaml yaml = new Yaml(new Dumper(new ReversedRepresenter()));
+ Yaml yaml = new Yaml(new ReversedRepresenter());
String output = yaml.dump(getBean());
// System.out.println(output);
assertEquals(Util.getLocalResource("issues/issue59-1.yaml"), output);
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue60/SkipBeanTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue60/SkipBeanTest.java
index c156fef..5030059 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue60/SkipBeanTest.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue60/SkipBeanTest.java
@@ -20,7 +20,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.Util;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.introspector.Property;
@@ -35,7 +34,7 @@
public class SkipBeanTest extends TestCase {
public void testSkipNull() {
- Yaml yaml = new Yaml(new Dumper(new SkipNullRepresenter()));
+ Yaml yaml = new Yaml(new SkipNullRepresenter());
String output = yaml.dump(getBean());
// System.out.println(output);
assertEquals(Util.getLocalResource("issues/issue60-1.yaml"), output);
@@ -55,7 +54,7 @@
}
public void testSkipEmptyCollections() {
- Yaml yaml = new Yaml(new Dumper(new SkipEmptyRepresenter()));
+ Yaml yaml = new Yaml(new SkipEmptyRepresenter());
String output = yaml.dump(getBean());
// System.out.println(output);
assertEquals(Util.getLocalResource("issues/issue60-2.yaml"), output);
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue67/NonAsciiCharsInClassNameTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue67/NonAsciiCharsInClassNameTest.java
index c25634c..0fb4aa3 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue67/NonAsciiCharsInClassNameTest.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue67/NonAsciiCharsInClassNameTest.java
@@ -18,7 +18,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.Util;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.nodes.Tag;
@@ -108,7 +107,7 @@
obj.setName("Foo bar 123");
Representer repr = new Representer();
repr.addClassTag(Académico.class, new Tag("!foo"));
- Yaml yaml = new Yaml(new Dumper(repr));
+ Yaml yaml = new Yaml(repr);
String result = yaml.dump(obj);
assertEquals("!foo {id: 123, name: Foo bar 123}\n", result);
}
@@ -119,7 +118,7 @@
obj.setName("Foo bar 123");
Representer repr = new Representer();
repr.addClassTag(Académico.class, new Tag("!Académico"));
- Yaml yaml = new Yaml(new Dumper(repr));
+ Yaml yaml = new Yaml(repr);
String result = yaml.dump(obj);
assertEquals("!Acad%C3%A9mico {id: 123, name: Foo bar 123}\n", result);
}
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue73/DumpSetAsSequenceExampleTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue73/DumpSetAsSequenceExampleTest.java
index 722b683..01131a6 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue73/DumpSetAsSequenceExampleTest.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue73/DumpSetAsSequenceExampleTest.java
@@ -21,7 +21,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Util;
import org.yaml.snakeyaml.Yaml;
@@ -34,7 +33,7 @@
public void testDumpFlow() {
DumperOptions options = new DumperOptions();
options.setAllowReadOnlyProperties(true);
- Yaml yaml = new Yaml(new Dumper(new SetRepresenter(), options));
+ Yaml yaml = new Yaml(new SetRepresenter(), options);
String output = yaml.dump(createBlog());
// System.out.println(output);
assertEquals(Util.getLocalResource("issues/issue73-dump7.txt"), output);
@@ -46,7 +45,7 @@
DumperOptions options = new DumperOptions();
options.setAllowReadOnlyProperties(true);
options.setDefaultFlowStyle(FlowStyle.BLOCK);
- Yaml yaml = new Yaml(new Dumper(new SetRepresenter(), options));
+ Yaml yaml = new Yaml(new SetRepresenter(), options);
String output = yaml.dump(createBlog());
// System.out.println(output);
assertEquals(Util.getLocalResource("issues/issue73-dump8.txt"), output);
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue73/SetAsSequenceTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue73/SetAsSequenceTest.java
index 587af8b..6b93407 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue73/SetAsSequenceTest.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue73/SetAsSequenceTest.java
@@ -23,7 +23,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.JavaBeanLoader;
import org.yaml.snakeyaml.Util;
@@ -45,7 +44,7 @@
blog.setLabels(labels);
DumperOptions options = new DumperOptions();
options.setAllowReadOnlyProperties(true);
- Yaml yaml = new Yaml(new Dumper(options));
+ Yaml yaml = new Yaml(options);
String output = yaml.dump(blog);
// System.out.println(output);
assertEquals(Util.getLocalResource("issues/issue73-1.txt"), output);
diff --git a/src/test/java/org/yaml/snakeyaml/javabeans/LongTest.java b/src/test/java/org/yaml/snakeyaml/javabeans/LongTest.java
index 2a2f9bf..99f8a4f 100644
--- a/src/test/java/org/yaml/snakeyaml/javabeans/LongTest.java
+++ b/src/test/java/org/yaml/snakeyaml/javabeans/LongTest.java
@@ -18,7 +18,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.nodes.Tag;
@@ -56,8 +55,7 @@
options.setDefaultScalarStyle(DumperOptions.ScalarStyle.DOUBLE_QUOTED);
Representer repr = new Representer();
repr.addClassTag(Long.class, new Tag("!!java.lang.Long"));
- Dumper dumper = new Dumper(repr, options);
- Yaml yaml = new Yaml(dumper);
+ Yaml yaml = new Yaml(repr, options);
Foo foo = new Foo();
String output = yaml.dump(foo);
diff --git a/src/test/java/org/yaml/snakeyaml/recursive/generics/HumanGenericsTest.java b/src/test/java/org/yaml/snakeyaml/recursive/generics/HumanGenericsTest.java
index 8aa5fba..b7f9b35 100644
--- a/src/test/java/org/yaml/snakeyaml/recursive/generics/HumanGenericsTest.java
+++ b/src/test/java/org/yaml/snakeyaml/recursive/generics/HumanGenericsTest.java
@@ -30,7 +30,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.JavaBeanLoader;
import org.yaml.snakeyaml.TypeDescription;
@@ -224,8 +223,7 @@
//
Representer representer = new Representer();
representer.addClassTag(HumanGen2.class, Tag.MAP);
- Dumper dumper = new Dumper(representer, new DumperOptions());
- Yaml yaml = new Yaml(dumper);
+ Yaml yaml = new Yaml(representer);
String output = yaml.dump(son);
// System.out.println(output);
String etalon = Util.getLocalResource("recursive/generics/with-children-2.yaml");
diff --git a/src/test/java/org/yaml/snakeyaml/representer/FilterPropertyToDumpTest.java b/src/test/java/org/yaml/snakeyaml/representer/FilterPropertyToDumpTest.java
index f0040b4..c2dd9a0 100644
--- a/src/test/java/org/yaml/snakeyaml/representer/FilterPropertyToDumpTest.java
+++ b/src/test/java/org/yaml/snakeyaml/representer/FilterPropertyToDumpTest.java
@@ -21,7 +21,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.JavaBeanDumper;
import org.yaml.snakeyaml.Yaml;
@@ -43,8 +42,7 @@
public void testFilterProperty2() {
BeanToRemoveProperty bean = new BeanToRemoveProperty();
bean.setNumber(24);
- Dumper dumper = new Dumper(new MyRepresenter(), new DumperOptions());
- Yaml yaml = new Yaml(dumper);
+ Yaml yaml = new Yaml(new MyRepresenter());
String dump = yaml.dump(bean);
// System.out.println(dump);
assertEquals(
diff --git a/src/test/java/org/yaml/snakeyaml/ruby/RubyTest.java b/src/test/java/org/yaml/snakeyaml/ruby/RubyTest.java
index a8c80e8..faf93b3 100644
--- a/src/test/java/org/yaml/snakeyaml/ruby/RubyTest.java
+++ b/src/test/java/org/yaml/snakeyaml/ruby/RubyTest.java
@@ -18,7 +18,6 @@
import junit.framework.TestCase;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.JavaBeanLoader;
import org.yaml.snakeyaml.TypeDescription;
@@ -65,7 +64,7 @@
repr.addClassTag(TestObject.class, new Tag("!ruby/object:Test::Module::Object"));
repr.addClassTag(Sub1.class, new Tag("!ruby/object:Test::Module::Sub1"));
repr.addClassTag(Sub2.class, new Tag("!ruby/object:Test::Module::Sub2"));
- Yaml yaml2 = new Yaml(new Dumper(repr, options));
+ Yaml yaml2 = new Yaml(repr, options);
String output = yaml2.dump(result);
// System.out.println(output);
assertTrue("Tags must be present.", output
diff --git a/src/test/java/org/yaml/snakeyaml/types/BoolTagTest.java b/src/test/java/org/yaml/snakeyaml/types/BoolTagTest.java
index b59552f..916fd92 100644
--- a/src/test/java/org/yaml/snakeyaml/types/BoolTagTest.java
+++ b/src/test/java/org/yaml/snakeyaml/types/BoolTagTest.java
@@ -20,7 +20,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.DumperOptions.FlowStyle;
@@ -79,7 +78,7 @@
}
public void testBoolOutAsYes() throws IOException {
- Yaml yaml = new Yaml(new Dumper(new BoolRepresenter("YES")));
+ Yaml yaml = new Yaml(new BoolRepresenter("YES"));
String output = yaml.dump(true);
assertEquals("YES\n", output);
}
@@ -88,7 +87,7 @@
* test flow style
*/
public void testBoolOutAsEmpty2() throws IOException {
- Yaml yaml = new Yaml(new Dumper(new BoolRepresenter("on")));
+ Yaml yaml = new Yaml(new BoolRepresenter("on"));
Map<String, Boolean> map = new HashMap<String, Boolean>();
map.put("aaa", false);
map.put("bbb", true);
@@ -102,7 +101,7 @@
public void testBoolOutAsEmpty3() throws IOException {
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(FlowStyle.BLOCK);
- Yaml yaml = new Yaml(new Dumper(new BoolRepresenter("True"), options));
+ Yaml yaml = new Yaml(new BoolRepresenter("True"), options);
Map<String, Boolean> map = new HashMap<String, Boolean>();
map.put("aaa", false);
map.put("bbb", true);
diff --git a/src/test/java/org/yaml/snakeyaml/types/NullTagTest.java b/src/test/java/org/yaml/snakeyaml/types/NullTagTest.java
index ff265ff..da8d0eb 100644
--- a/src/test/java/org/yaml/snakeyaml/types/NullTagTest.java
+++ b/src/test/java/org/yaml/snakeyaml/types/NullTagTest.java
@@ -21,7 +21,6 @@
import java.util.List;
import java.util.Map;
-import org.yaml.snakeyaml.Dumper;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.DumperOptions.FlowStyle;
@@ -94,7 +93,7 @@
}
public void testNullOutAsEmpty() throws IOException {
- Yaml yaml = new Yaml(new Dumper(new NullRepresenter(), new DumperOptions()));
+ Yaml yaml = new Yaml(new NullRepresenter());
String output = yaml.dump(null);
assertEquals("", output);
}
@@ -103,7 +102,7 @@
* test flow style
*/
public void testNullOutAsEmpty2() throws IOException {
- Yaml yaml = new Yaml(new Dumper(new NullRepresenter()));
+ Yaml yaml = new Yaml(new NullRepresenter());
Map<String, String> map = new HashMap<String, String>();
map.put("aaa", "foo");
map.put("bbb", null);
@@ -117,7 +116,7 @@
public void testBoolOutAsEmpty3() throws IOException {
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(FlowStyle.BLOCK);
- Yaml yaml = new Yaml(new Dumper(new NullRepresenter(), options));
+ Yaml yaml = new Yaml(new NullRepresenter(), options);
Map<String, String> map = new HashMap<String, String>();
map.put("aaa", "foo");
map.put("bbb", null);