aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/yaml/snakeyaml/immutable
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/yaml/snakeyaml/immutable')
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Animal.java21
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Code.java65
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Code2.java71
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Code3.java69
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Code4.java74
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Color.java65
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Dog.java41
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/DogImmutableTest.java41
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/HouseBean.java47
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/ImmutablesRepresenter.java93
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/MoreImmutablesTest.java107
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Point.java73
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Point2.java59
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Point3d.java51
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/Shape.java91
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/ShapeImmutableTest.java259
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/SuperColor.java71
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/primitives/BunchOfPrimitives.java97
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesRepresenter.java45
-rw-r--r--src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesTest.java72
20 files changed, 736 insertions, 776 deletions
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Animal.java b/src/test/java/org/yaml/snakeyaml/immutable/Animal.java
index f7dcb73a..0828bfee 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Animal.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Animal.java
@@ -1,20 +1,19 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
public interface Animal {
- public String getName();
+
+ String getName();
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Code.java b/src/test/java/org/yaml/snakeyaml/immutable/Code.java
index 3ef1de47..c29ed1ce 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Code.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Code.java
@@ -1,48 +1,47 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
public class Code {
- private final Integer code;
- public Code(Integer name) {
- this.code = name;
- }
+ private final Integer code;
- public Integer getCode() {
- return code;
- }
+ public Code(Integer name) {
+ this.code = name;
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof Code) {
- Code code = (Code) obj;
- return code.equals(code.code);
- } else {
- return false;
- }
- }
+ public Integer getCode() {
+ return code;
+ }
- @Override
- public int hashCode() {
- return code.hashCode();
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Code) {
+ Code code = (Code) obj;
+ return code.equals(code.code);
+ } else {
+ return false;
}
+ }
- @Override
- public String toString() {
- return "<Code code=" + code + ">";
- }
+ @Override
+ public int hashCode() {
+ return code.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "<Code code=" + code + ">";
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Code2.java b/src/test/java/org/yaml/snakeyaml/immutable/Code2.java
index 02fc2e9b..4cae9674 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Code2.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Code2.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
@@ -19,37 +17,38 @@ package org.yaml.snakeyaml.immutable;
* Two constructors with 1 argument. These immutable objects are not supported.
*/
public class Code2 {
- private final Integer code;
- public Code2(Integer name) {
- this.code = name;
- }
+ private final Integer code;
- public Code2(String name) {
- this.code = new Integer(name);
- }
+ public Code2(Integer name) {
+ this.code = name;
+ }
- public Integer getCode() {
- return code;
- }
+ public Code2(String name) {
+ this.code = Integer.valueOf(name);
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof Code2) {
- Code2 code = (Code2) obj;
- return code.equals(code.code);
- } else {
- return false;
- }
- }
+ public Integer getCode() {
+ return code;
+ }
- @Override
- public int hashCode() {
- return code.hashCode();
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Code2) {
+ Code2 code = (Code2) obj;
+ return code.equals(code.code);
+ } else {
+ return false;
}
+ }
- @Override
- public String toString() {
- return "<Code2 code=" + code + ">";
- }
+ @Override
+ public int hashCode() {
+ return code.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "<Code2 code=" + code + ">";
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Code3.java b/src/test/java/org/yaml/snakeyaml/immutable/Code3.java
index 26385322..88b12eca 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Code3.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Code3.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
@@ -19,35 +17,36 @@ package org.yaml.snakeyaml.immutable;
* No constructors with 1 argument. These immutable objects are not supported.
*/
public class Code3 {
- private final String name;
- private final Integer code;
- public Code3(String name, Integer code) {
- this.code = code;
- this.name = name;
- }
+ private final String name;
+ private final Integer code;
- public String getData() {
- return name + code;
- }
+ public Code3(String name, Integer code) {
+ this.code = code;
+ this.name = name;
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof Code3) {
- Code3 code = (Code3) obj;
- return code.equals(code.code);
- } else {
- return false;
- }
- }
+ public String getData() {
+ return name + code;
+ }
- @Override
- public int hashCode() {
- return code.hashCode();
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Code3) {
+ Code3 code = (Code3) obj;
+ return code.equals(code.code);
+ } else {
+ return false;
}
+ }
- @Override
- public String toString() {
- return "<Code3 data=" + getData() + ">";
- }
+ @Override
+ public int hashCode() {
+ return code.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "<Code3 data=" + getData() + ">";
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Code4.java b/src/test/java/org/yaml/snakeyaml/immutable/Code4.java
index 71c6828e..c2ffa0a3 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Code4.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Code4.java
@@ -1,56 +1,54 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
/**
- * Two constructors with 1 argument. None of them has String as the argument
- * class.
+ * Two constructors with 1 argument. None of them has String as the argument class.
*/
public class Code4 {
- private final Integer code;
- public Code4(Integer name) {
- this.code = name;
- }
+ private final Integer code;
- public Code4(Double name) {
- this.code = new Integer(name.intValue());
- }
+ public Code4(Integer name) {
+ this.code = name;
+ }
- public Integer getCode() {
- return code;
- }
+ public Code4(Double name) {
+ this.code = Integer.valueOf(name.intValue());
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof Code4) {
- Code4 code = (Code4) obj;
- return code.equals(code.code);
- } else {
- return false;
- }
- }
+ public Integer getCode() {
+ return code;
+ }
- @Override
- public int hashCode() {
- return code.hashCode();
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Code4) {
+ Code4 code = (Code4) obj;
+ return code.equals(code.code);
+ } else {
+ return false;
}
+ }
- @Override
- public String toString() {
- return "<Code4 code=" + code + ">";
- }
+ @Override
+ public int hashCode() {
+ return code.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "<Code4 code=" + code + ">";
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Color.java b/src/test/java/org/yaml/snakeyaml/immutable/Color.java
index 2ac105a8..ee77b0c9 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Color.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Color.java
@@ -1,48 +1,47 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
public class Color {
- private final String name;
- public Color(String name) {
- this.name = name;
- }
+ private final String name;
- public String getName() {
- return name;
- }
+ public Color(String name) {
+ this.name = name;
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof Color) {
- Color color = (Color) obj;
- return name.equals(color.name);
- } else {
- return false;
- }
- }
+ public String getName() {
+ return name;
+ }
- @Override
- public int hashCode() {
- return name.hashCode();
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Color) {
+ Color color = (Color) obj;
+ return name.equals(color.name);
+ } else {
+ return false;
}
+ }
- @Override
- public String toString() {
- return "<Color id=" + name + ">";
- }
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "<Color id=" + name + ">";
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Dog.java b/src/test/java/org/yaml/snakeyaml/immutable/Dog.java
index 710aab3d..624e83a0 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Dog.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Dog.java
@@ -1,33 +1,32 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
public class Dog implements Animal {
- private String name;
- public Dog(String name) {
- super();
- this.name = name;
- }
+ private final String name;
- public String getName() {
- return name;
- }
+ public Dog(String name) {
+ super();
+ this.name = name;
+ }
- public void bark() {
- System.out.println("I am a " + name);
- }
+ public String getName() {
+ return name;
+ }
+
+ public void bark() {
+ System.out.println("I am a " + name);
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/DogImmutableTest.java b/src/test/java/org/yaml/snakeyaml/immutable/DogImmutableTest.java
index 90b1ff64..d5a19e89 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/DogImmutableTest.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/DogImmutableTest.java
@@ -1,36 +1,33 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
import junit.framework.TestCase;
-
import org.yaml.snakeyaml.Yaml;
public class DogImmutableTest extends TestCase {
- public void testDog() {
- Yaml yaml = new Yaml();
- Dog loaded = (Dog) yaml.load("!!org.yaml.snakeyaml.immutable.Dog Bulldog");
- assertEquals("Bulldog", loaded.getName());
- }
+ public void testDog() {
+ Yaml yaml = new Yaml();
+ Dog loaded = yaml.load("!!org.yaml.snakeyaml.immutable.Dog Bulldog");
+ assertEquals("Bulldog", loaded.getName());
+ }
- public void testHouse() {
- Yaml yaml = new Yaml();
- HouseBean loaded = (HouseBean) yaml
- .load("!!org.yaml.snakeyaml.immutable.HouseBean\nanimal: !!org.yaml.snakeyaml.immutable.Dog Bulldog");
- assertEquals("Bulldog", loaded.getAnimal().getName());
- }
+ public void testHouse() {
+ Yaml yaml = new Yaml();
+ HouseBean loaded = yaml.load(
+ "!!org.yaml.snakeyaml.immutable.HouseBean\nanimal: !!org.yaml.snakeyaml.immutable.Dog Bulldog");
+ assertEquals("Bulldog", loaded.getAnimal().getName());
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/HouseBean.java b/src/test/java/org/yaml/snakeyaml/immutable/HouseBean.java
index edee6b1b..e9fcd5e9 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/HouseBean.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/HouseBean.java
@@ -1,37 +1,36 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
public class HouseBean {
- private String name;
- private Animal animal;
- public String getName() {
- return name;
- }
+ private String name;
+ private Animal animal;
- public void setName(String name) {
- this.name = name;
- }
+ public String getName() {
+ return name;
+ }
- public Animal getAnimal() {
- return animal;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public void setAnimal(Animal animal) {
- this.animal = animal;
- }
+ public Animal getAnimal() {
+ return animal;
+ }
+
+ public void setAnimal(Animal animal) {
+ this.animal = animal;
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/ImmutablesRepresenter.java b/src/test/java/org/yaml/snakeyaml/immutable/ImmutablesRepresenter.java
index 0595731b..0c7d2d12 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/ImmutablesRepresenter.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/ImmutablesRepresenter.java
@@ -1,26 +1,23 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
import java.awt.Insets;
import java.awt.Rectangle;
import java.util.Arrays;
-
import javax.swing.border.MatteBorder;
-
+import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.representer.Represent;
@@ -28,55 +25,53 @@ import org.yaml.snakeyaml.representer.Representer;
public class ImmutablesRepresenter extends Representer {
- public ImmutablesRepresenter() {
- super();
- this.representers.put(java.awt.Color.class, new RepresentColor());
- this.representers.put(Insets.class, new RepresentInsets());
- this.representers.put(MatteBorder.class, new RepresentMatteBorder());
- this.representers.put(Rectangle.class, new RepresentRectangle());
+ public ImmutablesRepresenter() {
+ super();
+ this.representers.put(java.awt.Color.class, new RepresentColor());
+ this.representers.put(Insets.class, new RepresentInsets());
+ this.representers.put(MatteBorder.class, new RepresentMatteBorder());
+ this.representers.put(Rectangle.class, new RepresentRectangle());
+ }
+
+ class RepresentInsets implements Represent {
+
+ public Node representData(Object data) {
+ Insets insets = (Insets) data;
+ return representSequence(getTag(data.getClass(), new Tag(data.getClass())),
+ Arrays.asList(insets.top, insets.left, insets.bottom, insets.right),
+ DumperOptions.FlowStyle.FLOW);
}
- class RepresentInsets implements Represent {
+ }
- public Node representData(Object data) {
- Insets insets = (Insets) data;
- return representSequence(
- getTag(data.getClass(), new Tag(data.getClass())),
- Arrays.asList(new Object[] { insets.top, insets.left, insets.bottom,
- insets.right }), true);
- }
+ class RepresentRectangle implements Represent {
+ public Node representData(Object data) {
+ Rectangle rect = (Rectangle) data;
+ return representSequence(getTag(data.getClass(), new Tag(data.getClass())),
+ Arrays.asList(rect.x, rect.y, rect.width, rect.height), DumperOptions.FlowStyle.FLOW);
}
- class RepresentRectangle implements Represent {
+ }
- public Node representData(Object data) {
- Rectangle rect = (Rectangle) data;
- return representSequence(getTag(data.getClass(), new Tag(data.getClass())),
- Arrays.asList(new Object[] { rect.x, rect.y, rect.width, rect.height }), true);
- }
+ class RepresentMatteBorder implements Represent {
+ public Node representData(Object data) {
+ MatteBorder mb = (MatteBorder) data;
+ return representSequence(getTag(data.getClass(), new Tag(data.getClass())),
+ Arrays.asList(mb.getBorderInsets(), mb.getMatteColor()), DumperOptions.FlowStyle.FLOW);
}
- class RepresentMatteBorder implements Represent {
+ }
- public Node representData(Object data) {
- MatteBorder mb = (MatteBorder) data;
- return representSequence(getTag(data.getClass(), new Tag(data.getClass())),
- Arrays.asList(new Object[] { mb.getBorderInsets(), mb.getMatteColor() }), true);
- }
+ class RepresentColor implements Represent {
+ public Node representData(Object data) {
+ java.awt.Color color = (java.awt.Color) data;
+ return representSequence(getTag(data.getClass(), new Tag(data.getClass())),
+ Arrays.asList(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()),
+ DumperOptions.FlowStyle.FLOW);
}
- class RepresentColor implements Represent {
-
- public Node representData(Object data) {
- java.awt.Color color = (java.awt.Color) data;
- return representSequence(
- getTag(data.getClass(), new Tag(data.getClass())),
- Arrays.asList(new Integer[] { color.getRed(), color.getGreen(),
- color.getBlue(), color.getAlpha() }), true);
- }
-
- }
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/MoreImmutablesTest.java b/src/test/java/org/yaml/snakeyaml/immutable/MoreImmutablesTest.java
index b96b37a5..87a1bb1f 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/MoreImmutablesTest.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/MoreImmutablesTest.java
@@ -1,78 +1,73 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
import java.awt.Color;
import java.awt.Insets;
import java.awt.Rectangle;
-
import javax.swing.BorderFactory;
import javax.swing.border.MatteBorder;
-
import junit.framework.TestCase;
-
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
public class MoreImmutablesTest extends TestCase {
- public void testInsets() {
- 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);
- Object loaded = yaml.load(dump);
- assertEquals(insets, loaded);
- }
+ public void testInsets() {
+ 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);
+ Object loaded = yaml.load(dump);
+ assertEquals(insets, loaded);
+ }
- public void testAwtColor() {
- 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);
- Object loaded = yaml.load(dump);
- assertEquals(color, loaded);
- }
+ public void testAwtColor() {
+ 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);
+ Object loaded = yaml.load(dump);
+ assertEquals(color, loaded);
+ }
- public void testRectangle() {
- 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);
- Object loaded = yaml.load(dump);
- assertEquals(rect, loaded);
- }
+ public void testRectangle() {
+ 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);
+ Object loaded = yaml.load(dump);
+ assertEquals(rect, loaded);
+ }
- // matteborder - only with color - no icon
- public void testMatteBorder() {
- DumperOptions options = new DumperOptions();
- options.setWidth(400);
- 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,
- insets.bottom, insets.right, color);
- String dump = yaml.dump(border);
- assertEquals(
- "!!javax.swing.border.MatteBorder [!!java.awt.Insets [10, 20, 30, 40], !!java.awt.Color [100, 150, 200, 255]]\n",
- dump);
- Object loaded = yaml.load(dump);
- assertTrue(loaded instanceof MatteBorder);
- MatteBorder loadedBorder = (MatteBorder) loaded;
- assertEquals(insets, loadedBorder.getBorderInsets());
- assertEquals(color, loadedBorder.getMatteColor());
- }
+ // matteborder - only with color - no icon
+ public void testMatteBorder() {
+ DumperOptions options = new DumperOptions();
+ options.setWidth(400);
+ 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, insets.bottom,
+ insets.right, color);
+ String dump = yaml.dump(border);
+ assertEquals(
+ "!!javax.swing.border.MatteBorder [!!java.awt.Insets [10, 20, 30, 40], !!java.awt.Color [100, 150, 200, 255]]\n",
+ dump);
+ Object loaded = yaml.load(dump);
+ assertTrue(loaded instanceof MatteBorder);
+ MatteBorder loadedBorder = (MatteBorder) loaded;
+ assertEquals(insets, loadedBorder.getBorderInsets());
+ assertEquals(color, loadedBorder.getMatteColor());
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Point.java b/src/test/java/org/yaml/snakeyaml/immutable/Point.java
index 98312dac..d005529e 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Point.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Point.java
@@ -1,53 +1,52 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
public class Point {
- private final double x;
- private final double y;
- public double getX() {
- return x;
- }
+ private final double x;
+ private final double y;
- public double getY() {
- return y;
- }
+ public double getX() {
+ return x;
+ }
- public Point(Double x, Double y) {
- this.x = x;
- this.y = y;
- }
+ public double getY() {
+ return y;
+ }
- @Override
- public String toString() {
- return "<Point x=" + String.valueOf(x) + " y=" + String.valueOf(y) + ">";
- }
+ public Point(Double x, Double y) {
+ this.x = x;
+ this.y = y;
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof Point) {
- return toString().equals(obj.toString());
- } else {
- return false;
- }
- }
+ @Override
+ public String toString() {
+ return "<Point x=" + x + " y=" + y + ">";
+ }
- @Override
- public int hashCode() {
- return toString().hashCode();
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Point) {
+ return toString().equals(obj.toString());
+ } else {
+ return false;
}
+ }
+
+ @Override
+ public int hashCode() {
+ return toString().hashCode();
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Point2.java b/src/test/java/org/yaml/snakeyaml/immutable/Point2.java
index 89d1c854..a9a70075 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Point2.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Point2.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
@@ -19,29 +17,30 @@ package org.yaml.snakeyaml.immutable;
* Two public constructor with 2 argument are present
*/
public class Point2 {
- private final Integer x;
- private final Integer y;
- public Integer getX() {
- return x;
- }
+ private final Integer x;
+ private final Integer y;
- public Integer getY() {
- return y;
- }
+ public Integer getX() {
+ return x;
+ }
- public Point2(Double x, Double y) {
- this.x = x.intValue();
- this.y = y.intValue();
- }
+ public Integer getY() {
+ return y;
+ }
- public Point2(Integer x, Integer y) {
- this.x = x;
- this.y = y;
- }
+ public Point2(Double x, Double y) {
+ this.x = x.intValue();
+ this.y = y.intValue();
+ }
- @Override
- public String toString() {
- return "<Point2 x=" + String.valueOf(x) + " y=" + String.valueOf(y) + ">";
- }
+ public Point2(Integer x, Integer y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ @Override
+ public String toString() {
+ return "<Point2 x=" + x + " y=" + y + ">";
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Point3d.java b/src/test/java/org/yaml/snakeyaml/immutable/Point3d.java
index 333de040..e9609f14 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Point3d.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Point3d.java
@@ -1,39 +1,38 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
public class Point3d {
- private final double z;
- private final Point point;
- public Point3d(Point point, Double z) {
- this.point = point;
- this.z = z;
- }
+ private final double z;
+ private final Point point;
- public double getZ() {
- return z;
- }
+ public Point3d(Point point, Double z) {
+ this.point = point;
+ this.z = z;
+ }
- public Point getPoint() {
- return point;
- }
+ public double getZ() {
+ return z;
+ }
- @Override
- public String toString() {
- return "<Point3d point=" + point.toString() + " z=" + String.valueOf(z) + ">";
- }
+ public Point getPoint() {
+ return point;
+ }
+
+ @Override
+ public String toString() {
+ return "<Point3d point=" + point.toString() + " z=" + z + ">";
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/Shape.java b/src/test/java/org/yaml/snakeyaml/immutable/Shape.java
index b1f0b412..56f8cca7 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/Shape.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/Shape.java
@@ -1,55 +1,54 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
public class Shape {
- private Color color;
- private Point point;
- private Point3d point3d;
- private Integer id;
-
- public Point3d getPoint3d() {
- return point3d;
- }
-
- public void setPoint3d(Point3d point3d) {
- this.point3d = point3d;
- }
-
- public void setColor(Color color) {
- this.color = color;
- }
-
- public void setPoint(Point point) {
- this.point = point;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Color getColor() {
- return color;
- }
-
- public Point getPoint() {
- return point;
- }
-
- public Integer getId() {
- return id;
- }
+
+ private Color color;
+ private Point point;
+ private Point3d point3d;
+ private Integer id;
+
+ public Point3d getPoint3d() {
+ return point3d;
+ }
+
+ public void setPoint3d(Point3d point3d) {
+ this.point3d = point3d;
+ }
+
+ public void setColor(Color color) {
+ this.color = color;
+ }
+
+ public void setPoint(Point point) {
+ this.point = point;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Color getColor() {
+ return color;
+ }
+
+ public Point getPoint() {
+ return point;
+ }
+
+ public Integer getId() {
+ return id;
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/ShapeImmutableTest.java b/src/test/java/org/yaml/snakeyaml/immutable/ShapeImmutableTest.java
index 4d8f4549..971509eb 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/ShapeImmutableTest.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/ShapeImmutableTest.java
@@ -1,151 +1,144 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
import junit.framework.TestCase;
-
import org.yaml.snakeyaml.Util;
import org.yaml.snakeyaml.Yaml;
public class ShapeImmutableTest extends TestCase {
- public void testColor() {
- Yaml yaml = new Yaml();
- Color loaded = (Color) yaml.load("!!org.yaml.snakeyaml.immutable.Color BLACK");
- assertEquals("BLACK", loaded.getName());
- }
-
- public void testCode() {
- Yaml yaml = new Yaml();
- Code loaded = (Code) yaml.load("!!org.yaml.snakeyaml.immutable.Code 123");
- assertEquals(new Integer(123), loaded.getCode());
- }
-
- public void testSuperColor() {
- Yaml yaml = new Yaml();
- SuperColor superColor = (SuperColor) yaml
- .load("!!org.yaml.snakeyaml.immutable.SuperColor [!!org.yaml.snakeyaml.immutable.Color BLACK]");
- assertEquals("BLACK", superColor.getColor().getName());
- }
-
- public void testSuperColorFail() {
- Yaml yaml = new Yaml();
- try {
- yaml.load("!!org.yaml.snakeyaml.immutable.SuperColor BLACK");
- fail("SuperColor requires Color and not a String.");
- } catch (Exception e) {
- assertTrue(e
- .getMessage()
- .startsWith(
- "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.SuperColor; exception=Unsupported class: class org.yaml.snakeyaml.immutable.Color"));
- }
- }
-
- public void testCode2() {
- Yaml yaml = new Yaml();
- Code2 code2 = (Code2) yaml.load("!!org.yaml.snakeyaml.immutable.Code2 555");
- assertEquals(new Integer(555), code2.getCode());
- }
-
- public void testCode3() {
- Yaml yaml = new Yaml();
- try {
- yaml.load("!!org.yaml.snakeyaml.immutable.Code3 777");
- fail("There must be 1 constructor with 1 argument for scalar.");
- } catch (Exception e) {
- assertTrue(e
- .getMessage()
- .startsWith(
- "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.Code3; exception=No single argument constructor found for class org.yaml.snakeyaml.immutable.Code3"));
- }
- }
-
- public void testCode4() {
- Yaml yaml = new Yaml();
- try {
- yaml.load("!!org.yaml.snakeyaml.immutable.Code4 777");
- fail("Constructor with String is required.");
- } catch (Exception e) {
- assertEquals(
- "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.Code4; exception=Can't construct a java object for scalar tag:yaml.org,2002:org.yaml.snakeyaml.immutable.Code4; No String constructor found. Exception=org.yaml.snakeyaml.immutable.Code4.<init>(java.lang.String)\n"
- + " in 'string', line 1, column 1:\n"
- + " !!org.yaml.snakeyaml.immutable.C ... \n" + " ^\n",
- e.getMessage());
- }
- }
-
- public void testPoint() {
- Yaml yaml = new Yaml();
- Point loaded = (Point) yaml.load("!!org.yaml.snakeyaml.immutable.Point [1.17, 3.14]");
- assertEquals(1.17, loaded.getX());
- assertEquals(3.14, loaded.getY());
- }
-
- public void testPointBlock() {
- Yaml yaml = new Yaml();
- Point loaded = (Point) yaml.load("!!org.yaml.snakeyaml.immutable.Point\n- 1.17\n- 3.14");
- assertEquals(1.17, loaded.getX());
- assertEquals(3.14, loaded.getY());
- }
-
- public void testPointOnlyOneArgument() {
- Yaml yaml = new Yaml();
- try {
- yaml.load("!!org.yaml.snakeyaml.immutable.Point\n- 1.17");
- fail("Two arguments required.");
- } catch (Exception e) {
- assertEquals(
- "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.Point; exception=No suitable constructor with 1 arguments found for class org.yaml.snakeyaml.immutable.Point\n"
- + " in 'string', line 1, column 1:\n"
- + " !!org.yaml.snakeyaml.immutable.Point\n" + " ^\n",
- e.getMessage());
- }
- }
-
- public void testPoint2() {
- Yaml yaml = new Yaml();
- Point2 loaded = (Point2) yaml.load("!!org.yaml.snakeyaml.immutable.Point2\n- 1\n- 3");
- assertEquals(new Integer(1), loaded.getX());
- assertEquals(new Integer(3), loaded.getY());
+ public void testColor() {
+ Yaml yaml = new Yaml();
+ Color loaded = yaml.load("!!org.yaml.snakeyaml.immutable.Color BLACK");
+ assertEquals("BLACK", loaded.getName());
+ }
+
+ public void testCode() {
+ Yaml yaml = new Yaml();
+ Code loaded = yaml.load("!!org.yaml.snakeyaml.immutable.Code 123");
+ assertEquals(Integer.valueOf(123), loaded.getCode());
+ }
+
+ public void testSuperColor() {
+ Yaml yaml = new Yaml();
+ SuperColor superColor = yaml.load(
+ "!!org.yaml.snakeyaml.immutable.SuperColor [!!org.yaml.snakeyaml.immutable.Color BLACK]");
+ assertEquals("BLACK", superColor.getColor().getName());
+ }
+
+ public void testSuperColorFail() {
+ Yaml yaml = new Yaml();
+ try {
+ yaml.load("!!org.yaml.snakeyaml.immutable.SuperColor BLACK");
+ fail("SuperColor requires Color and not a String.");
+ } catch (Exception e) {
+ assertTrue(e.getMessage().startsWith(
+ "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.SuperColor; exception=Unsupported class: class org.yaml.snakeyaml.immutable.Color"));
}
-
- public void testPoint3d() {
- Yaml yaml = new Yaml();
- Point3d loaded = (Point3d) yaml
- .load("!!org.yaml.snakeyaml.immutable.Point3d [!!org.yaml.snakeyaml.immutable.Point [1.17, 3.14], 345.1]");
- assertEquals(345.1, loaded.getZ());
+ }
+
+ public void testCode2() {
+ Yaml yaml = new Yaml();
+ Code2 code2 = yaml.load("!!org.yaml.snakeyaml.immutable.Code2 555");
+ assertEquals(Integer.valueOf(555), code2.getCode());
+ }
+
+ public void testCode3() {
+ Yaml yaml = new Yaml();
+ try {
+ yaml.load("!!org.yaml.snakeyaml.immutable.Code3 777");
+ fail("There must be 1 constructor with 1 argument for scalar.");
+ } catch (Exception e) {
+ assertTrue(e.getMessage().startsWith(
+ "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.Code3; exception=No single argument constructor found for class org.yaml.snakeyaml.immutable.Code3"));
}
-
- public void testShape() {
- Yaml yaml = new Yaml();
- String source = Util.getLocalResource("immutable/shape1.yaml");
- Shape loaded = (Shape) yaml.load(source);
- assertEquals(new Integer(123), loaded.getId());
+ }
+
+ public void testCode4() {
+ Yaml yaml = new Yaml();
+ try {
+ yaml.load("!!org.yaml.snakeyaml.immutable.Code4 777");
+ fail("Constructor with String is required.");
+ } catch (Exception e) {
+ assertEquals(
+ "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.Code4; exception=Can't construct a java object for scalar tag:yaml.org,2002:org.yaml.snakeyaml.immutable.Code4; No String constructor found. Exception=org.yaml.snakeyaml.immutable.Code4.<init>(java.lang.String)\n"
+ + " in 'string', line 1, column 1:\n" + " !!org.yaml.snakeyaml.immutable.C ... \n"
+ + " ^\n",
+ e.getMessage());
}
-
- public void testShapeNoTags() {
- String source = Util.getLocalResource("immutable/shapeNoTags.yaml");
- Yaml beanLoader = new Yaml();
- Shape loaded = beanLoader.loadAs(source, Shape.class);
- assertEquals(new Integer(123), loaded.getId());
- assertEquals("BLACK", loaded.getColor().getName());
- assertEquals(1.17, loaded.getPoint().getX());
- assertEquals(3.14, loaded.getPoint().getY());
- assertEquals(345.1, loaded.getPoint3d().getZ());
- assertEquals(1.96, loaded.getPoint3d().getPoint().getX());
- assertEquals(1.78, loaded.getPoint3d().getPoint().getY());
+ }
+
+ public void testPoint() {
+ Yaml yaml = new Yaml();
+ Point loaded = yaml.load("!!org.yaml.snakeyaml.immutable.Point [1.17, 3.14]");
+ assertEquals(1.17, loaded.getX());
+ assertEquals(3.14, loaded.getY());
+ }
+
+ public void testPointBlock() {
+ Yaml yaml = new Yaml();
+ Point loaded = yaml.load("!!org.yaml.snakeyaml.immutable.Point\n- 1.17\n- 3.14");
+ assertEquals(1.17, loaded.getX());
+ assertEquals(3.14, loaded.getY());
+ }
+
+ public void testPointOnlyOneArgument() {
+ Yaml yaml = new Yaml();
+ try {
+ yaml.load("!!org.yaml.snakeyaml.immutable.Point\n- 1.17");
+ fail("Two arguments required.");
+ } catch (Exception e) {
+ assertEquals(
+ "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.Point; exception=No suitable constructor with 1 arguments found for class org.yaml.snakeyaml.immutable.Point\n"
+ + " in 'string', line 1, column 1:\n" + " !!org.yaml.snakeyaml.immutable.Point\n"
+ + " ^\n",
+ e.getMessage());
}
+ }
+
+ public void testPoint2() {
+ Yaml yaml = new Yaml();
+ Point2 loaded = yaml.load("!!org.yaml.snakeyaml.immutable.Point2\n- 1\n- 3");
+ assertEquals(Integer.valueOf(1), loaded.getX());
+ assertEquals(Integer.valueOf(3), loaded.getY());
+ }
+
+ public void testPoint3d() {
+ Yaml yaml = new Yaml();
+ Point3d loaded = yaml.load(
+ "!!org.yaml.snakeyaml.immutable.Point3d [!!org.yaml.snakeyaml.immutable.Point [1.17, 3.14], 345.1]");
+ assertEquals(345.1, loaded.getZ());
+ }
+
+ public void testShape() {
+ Yaml yaml = new Yaml();
+ String source = Util.getLocalResource("immutable/shape1.yaml");
+ Shape loaded = yaml.load(source);
+ assertEquals(Integer.valueOf(123), loaded.getId());
+ }
+
+ public void testShapeNoTags() {
+ String source = Util.getLocalResource("immutable/shapeNoTags.yaml");
+ Yaml beanLoader = new Yaml();
+ Shape loaded = beanLoader.loadAs(source, Shape.class);
+ assertEquals(Integer.valueOf(123), loaded.getId());
+ assertEquals("BLACK", loaded.getColor().getName());
+ assertEquals(1.17, loaded.getPoint().getX());
+ assertEquals(3.14, loaded.getPoint().getY());
+ assertEquals(345.1, loaded.getPoint3d().getZ());
+ assertEquals(1.96, loaded.getPoint3d().getPoint().getX());
+ assertEquals(1.78, loaded.getPoint3d().getPoint().getY());
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/SuperColor.java b/src/test/java/org/yaml/snakeyaml/immutable/SuperColor.java
index 0a249628..43b01a3d 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/SuperColor.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/SuperColor.java
@@ -1,52 +1,51 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable;
public class SuperColor {
- private final Color color;
- public SuperColor(Color name) {
- this.color = name;
- }
+ private final Color color;
- public Color getName() {
- return color;
- }
+ public SuperColor(Color name) {
+ this.color = name;
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof SuperColor) {
- SuperColor color = (SuperColor) obj;
- return color.equals(color.color);
- } else {
- return false;
- }
- }
+ public Color getName() {
+ return color;
+ }
- @Override
- public int hashCode() {
- return color.hashCode();
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof SuperColor) {
+ SuperColor color = (SuperColor) obj;
+ return color.equals(color.color);
+ } else {
+ return false;
}
+ }
- @Override
- public String toString() {
- return "SuperColor color=" + color;
- }
+ @Override
+ public int hashCode() {
+ return color.hashCode();
+ }
- public Color getColor() {
- return color;
- }
+ @Override
+ public String toString() {
+ return "SuperColor color=" + color;
+ }
+
+ public Color getColor() {
+ return color;
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/primitives/BunchOfPrimitives.java b/src/test/java/org/yaml/snakeyaml/immutable/primitives/BunchOfPrimitives.java
index 19008b47..2f826cd4 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/primitives/BunchOfPrimitives.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/primitives/BunchOfPrimitives.java
@@ -1,67 +1,66 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable.primitives;
public class BunchOfPrimitives {
- private int primitiveInt;
- private double primitiveDouble;
- public boolean primitiveBoolean;
- public BunchOfPrimitives(int primitiveInt, double primitiveDouble, boolean primitiveBoolean) {
- this.primitiveInt = primitiveInt;
- this.primitiveDouble = primitiveDouble;
- this.primitiveBoolean = primitiveBoolean;
- }
+ private final int primitiveInt;
+ private double primitiveDouble;
+ public boolean primitiveBoolean;
- /**
- * The number of parameters is the same but the type is different
- */
- public BunchOfPrimitives(int i1, int i2, int i3) {
- this.primitiveInt = i1;
- }
+ public BunchOfPrimitives(int primitiveInt, double primitiveDouble, boolean primitiveBoolean) {
+ this.primitiveInt = primitiveInt;
+ this.primitiveDouble = primitiveDouble;
+ this.primitiveBoolean = primitiveBoolean;
+ }
- public BunchOfPrimitives(long i1, double i2, boolean i3) {
- this((int) i1, i2, i3);
- }
+ /**
+ * The number of parameters is the same but the type is different
+ */
+ public BunchOfPrimitives(int i1, int i2, int i3) {
+ this.primitiveInt = i1;
+ }
- public int getPrimitiveInt() {
- return primitiveInt;
- }
+ public BunchOfPrimitives(long i1, double i2, boolean i3) {
+ this((int) i1, i2, i3);
+ }
- public double getPrimitiveDouble() {
- return primitiveDouble;
- }
+ public int getPrimitiveInt() {
+ return primitiveInt;
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof BunchOfPrimitives) {
- BunchOfPrimitives bunch = (BunchOfPrimitives) obj;
- return primitiveInt == bunch.primitiveInt;
- } else {
- return false;
- }
- }
+ public double getPrimitiveDouble() {
+ return primitiveDouble;
+ }
- @Override
- public int hashCode() {
- return primitiveInt;
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof BunchOfPrimitives) {
+ BunchOfPrimitives bunch = (BunchOfPrimitives) obj;
+ return primitiveInt == bunch.primitiveInt;
+ } else {
+ return false;
}
+ }
- @Override
- public String toString() {
- return "BunchOfPrimitives " + primitiveInt;
- }
+ @Override
+ public int hashCode() {
+ return primitiveInt;
+ }
+
+ @Override
+ public String toString() {
+ return "BunchOfPrimitives " + primitiveInt;
+ }
}
diff --git a/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesRepresenter.java b/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesRepresenter.java
index 36745dc0..6de67cd9 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesRepresenter.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesRepresenter.java
@@ -1,40 +1,39 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable.primitives;
import java.util.Arrays;
-
+import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.representer.Represent;
import org.yaml.snakeyaml.representer.Representer;
public class ImmutablePrimitivesRepresenter extends Representer {
- public ImmutablePrimitivesRepresenter() {
- super();
- this.representers.put(BunchOfPrimitives.class, new RepresentPrimitives());
- }
- class RepresentPrimitives implements Represent {
- public Node representData(Object data) {
- BunchOfPrimitives bunch = (BunchOfPrimitives) data;
- return representSequence(
- getTag(data.getClass(), new Tag(data.getClass())),
- Arrays.asList(new Object[] { bunch.getPrimitiveInt(),
- bunch.getPrimitiveDouble(), bunch.primitiveBoolean }), true);
- }
+ public ImmutablePrimitivesRepresenter() {
+ super();
+ this.representers.put(BunchOfPrimitives.class, new RepresentPrimitives());
+ }
+
+ class RepresentPrimitives implements Represent {
+
+ public Node representData(Object data) {
+ BunchOfPrimitives bunch = (BunchOfPrimitives) data;
+ return representSequence(getTag(data.getClass(), new Tag(data.getClass())), Arrays
+ .asList(bunch.getPrimitiveInt(), bunch.getPrimitiveDouble(), bunch.primitiveBoolean),
+ DumperOptions.FlowStyle.FLOW);
}
+ }
}
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 801715b7..d50743f1 100644
--- a/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesTest.java
+++ b/src/test/java/org/yaml/snakeyaml/immutable/primitives/ImmutablePrimitivesTest.java
@@ -1,55 +1,51 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.immutable.primitives;
import junit.framework.TestCase;
-
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
public class ImmutablePrimitivesTest extends TestCase {
- public void testPrimitives() {
- 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);
- Object loaded = yaml.load(dump);
- assertEquals(loaded.toString(), bunch, loaded);
- }
+ public void testPrimitives() {
+ 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);
+ Object loaded = yaml.load(dump);
+ assertEquals(loaded.toString(), bunch, loaded);
+ }
- public void testPrimitivesLong() {
- Yaml yaml = new Yaml();
- String dump = "!!org.yaml.snakeyaml.immutable.primitives.BunchOfPrimitives [10000000000, 40.0, true]";
- BunchOfPrimitives bunch = (BunchOfPrimitives) yaml.load(dump);
- assertEquals("Must be truncated.", new Long(10000000000L).intValue(),
- bunch.getPrimitiveInt());
- }
+ public void testPrimitivesLong() {
+ Yaml yaml = new Yaml();
+ String dump =
+ "!!org.yaml.snakeyaml.immutable.primitives.BunchOfPrimitives [10000000000, 40.0, true]";
+ BunchOfPrimitives bunch = yaml.load(dump);
+ assertEquals("Must be truncated.", Long.valueOf(10000000000L).intValue(),
+ bunch.getPrimitiveInt());
+ }
- public void testPrimitivesException() {
- Yaml yaml = new Yaml();
- String dump = "!!org.yaml.snakeyaml.immutable.primitives.BunchOfPrimitives [10, 40, true]";
- try {
- yaml.load(dump);
- fail();
- } catch (YAMLException e) {
- assertTrue(e
- .getMessage()
- .startsWith(
- "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.primitives.BunchOfPrimitives; exception=No suitable constructor with 3 arguments found for class org.yaml.snakeyaml.immutable.primitives.BunchOfPrimitives"));
- }
+ public void testPrimitivesException() {
+ Yaml yaml = new Yaml();
+ String dump = "!!org.yaml.snakeyaml.immutable.primitives.BunchOfPrimitives [10, 40, true]";
+ try {
+ yaml.load(dump);
+ fail();
+ } catch (YAMLException e) {
+ assertTrue(e.getMessage().startsWith(
+ "Can't construct a java object for tag:yaml.org,2002:org.yaml.snakeyaml.immutable.primitives.BunchOfPrimitives; exception=No suitable constructor with 3 arguments found for class org.yaml.snakeyaml.immutable.primitives.BunchOfPrimitives"));
}
+ }
}