package org.yaml.snakeyaml.issues.issue40;

import java.math.BigDecimal;

import junit.framework.TestCase;

import org.yaml.snakeyaml.Yaml;

public class DogFoodBeanTest extends TestCase {

    public void testOwnBigDecimal() {
        DogFoodBean input = new DogFoodBean();
        input.setDecimal(new BigDecimal("5"));
        Yaml yaml = new Yaml();
        String text = yaml.dump(input);
        System.out.println(text);
        assertEquals("!!org.yaml.snakeyaml.issues.issue40.DogFoodBean {decimal: !!float '5'}\n",
                text);
        DogFoodBean output = (DogFoodBean) yaml.load(text);
        assertEquals(output.getDecimal(), input.getDecimal());
    }

    public void testBigDecimalPrecision() {
        DogFoodBean input = new DogFoodBean();
        input.setDecimal(new BigDecimal("5.123"));
        Yaml yaml = new Yaml();
        String text = yaml.dump(input);
        // System.out.println(text);
        assertEquals("!!org.yaml.snakeyaml.issues.issue40.DogFoodBean {decimal: 5.123}\n", text);
        DogFoodBean output = (DogFoodBean) yaml.load(text);
        assertEquals(input.getDecimal(), output.getDecimal());
    }

    public void testBigDecimal1() {
        Yaml yaml = new Yaml();
        String text = yaml.dump(new BigDecimal("5"));
        assertEquals("!!float '5'\n", text);
    }

    public void testBigDecimal2() {
        Yaml yaml = new Yaml();
        String text = yaml.dump(new BigDecimal("5.123"));
        assertEquals("5.123\n", text);
    }
}

@@ -101,16 +101,100 @@
 tCase;%0A%0A
+import org.yaml.snakeyaml.JavaBeanDumper;%0Aimport org.yaml.snakeyaml.JavaBeanLoader;%0A
 import o
@@ -217,16 +217,16 @@
 l.Yaml;%0A
-
 %0Apublic 
@@ -478,16 +478,19 @@
 %0A       
+ //
  System.
@@ -1099,32 +1099,32 @@
 123%7D%5Cn%22, text);%0A
-
         DogFoodB
@@ -1229,32 +1229,584 @@
 imal());%0A    %7D%0A%0A
+    public void testBigDecimalNoRootTag() %7B%0A        DogFoodBean input = new DogFoodBean();%0A        input.setDecimal(new BigDecimal(%225.123%22));%0A        JavaBeanDumper dumper = new JavaBeanDumper();%0A        String text = dumper.dump(input);%0A        // System.out.println(text);%0A        assertEquals(%22decimal: 5.123%5Cn%22, text);%0A        JavaBeanLoader%3CDogFoodBean%3E loader = new JavaBeanLoader%3CDogFoodBean%3E(DogFoodBean.class);%0A        DogFoodBean output = (DogFoodBean) loader.load(text);%0A        assertEquals(input.getDecimal(), output.getDecimal());%0A    %7D%0A%0A
     public void 

add testBigDecimalNoRootTag