package wikiboot.data;

import org.junit.Test;
import wikiboot.DataItem;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;

/**
 * Tests for {@link wikiboot.data.YamlDataSet}.
 */
public class YamlDataSetTests {

    @Test
    public void load() {
        YamlDataSet dataSet = new YamlDataSet("wikiboot/data/test-dataset.yaml");
        assertThat(dataSet.getDataItems().size(), is(3));
        for (DataItem item : dataSet.getDataItems()) {
            assertThat(item.getModel().get("name"), is(notNullValue()));
        }
    }

}

@@ -40,16 +40,70 @@
 t.Test;%0A
+import org.springframework.core.io.ByteArrayResource;%0A
 import w
@@ -672,10 +672,1254 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void textLiteral() %7B%0A        ByteArrayResource resource = new ByteArrayResource(%22test%22.getBytes());%0A        YamlDataSet dataSet = new YamlDataSet(resource);%0A%0A        assertThat(dataSet.getDataItems().size(), is(1));%0A%0A        DataItem dataItem = dataSet.getDataItems().get(0);%0A%0A        assertThat(dataItem.getModel().size(), is(1));%0A        assertThat(dataItem.getModel().get(%22document%22), is(%22test%22));%0A    %7D%0A%0A    @Test%0A    public void nonStringKey() %7B%0A        ByteArrayResource resource = new ByteArrayResource(%221: value%22.getBytes());%0A        YamlDataSet dataSet = new YamlDataSet(resource);%0A%0A        assertThat(dataSet.getDataItems().size(), is(1));%0A%0A        DataItem dataItem = dataSet.getDataItems().get(0);%0A%0A        assertThat(dataItem.getModel().size(), is(1));%0A        assertThat(dataItem.getModel().get(%22%5B1%5D%22), is(%22value%22));%0A    %7D%0A%0A    @Test%0A    public void emptyDocument() %7B%0A        ByteArrayResource resource = new ByteArrayResource(%22---%22.getBytes());%0A        YamlDataSet dataSet = new YamlDataSet(resource);%0A        assertThat(dataSet.getDataItems().size(), is(0));%0A    %7D%0A%0A    @Test(expected = IllegalStateException.class)%0A    public void dataSetNotFound() %7B%0A        new YamlDataSet(%22doesNotExist.yaml%22);%0A%0A    %7D%0A%0A%0A
 %7D%0A

Add more test cases for YamlDataSet