package examples;

import java.util.List;

import junit.framework.TestCase;

import org.yaml.snakeyaml.Yaml;

public class LoadExampleTest extends TestCase {
    @SuppressWarnings("unchecked")
    public void testLoad() {
        Yaml yaml = new Yaml();
        String document = "\n- Hesperiidae\n- Papilionidae\n- Apatelodidae\n- Epiplemidae";
        System.out.println(document);
        List<String> list = (List<String>) yaml.load(document);
        System.out.println(list);
        assertEquals("[Hesperiidae, Papilionidae, Apatelodidae, Epiplemidae]", list.toString());
    }

}

@@ -30,17 +30,201 @@
 ava.
-util.List
+io.ByteArrayInputStream;%0D%0Aimport java.io.File;%0D%0Aimport java.io.FileInputStream;%0D%0Aimport java.io.FileNotFoundException;%0D%0Aimport java.io.InputStream;%0D%0Aimport java.util.List;%0D%0Aimport java.util.Map
 ;%0D%0A%0D
@@ -782,11 +782,732 @@
    %7D%0D%0A%0D%0A
+    @SuppressWarnings(%22unchecked%22)%0D%0A    public void testLoadFromString() %7B%0D%0A        Yaml yaml = new Yaml();%0D%0A        String document = %22hello: 25%22;%0D%0A        Map map = (Map) yaml.load(document);%0D%0A        assertEquals(%22%7Bhello=25%7D%22, map.toString());%0D%0A        assertEquals(new Long(25), map.get(%22hello%22));%0D%0A    %7D%0D%0A%0D%0A    public void testLoadFromStream() throws FileNotFoundException %7B%0D%0A        InputStream input = new FileInputStream(new File(%22src/test/resources/reader/utf-8.txt%22));%0D%0A        Yaml yaml = new Yaml();%0D%0A        Object data = yaml.load(input);%0D%0A        assertEquals(%22test%22, data);%0D%0A        //%0D%0A        data = yaml.load(new ByteArrayInputStream(%22test2%22.getBytes()));%0D%0A        assertEquals(%22test2%22, data);%0D%0A    %7D%0D%0A
 %7D%0D%0A

add more code examples