/*
 * algorithms  Copyright (C) 2015 Ratchet Robotics
 *  Licensed under the BSD license.
 */

import org.junit.Test;
import org.ratchetrobotics.algorithms.mapping.FieldMap;

import java.io.IOException;

import static org.junit.Assert.assertNotNull;


public class FieldMapTest {
    @Test
    public void itShouldNotBarfOnValidInput() throws IOException {
        String someGeoJSON = "{ \"type\": \"FeatureCollection\",\n" +
                "  \"features\": [\n" +
                "    { \"type\": \"Feature\",\n" +
                "      \"geometry\": {\"type\": \"Point\", \"coordinates\": [102.0, 0.5]},\n" +
                "      \"properties\": {\"prop0\": \"value0\"}\n" +
                "      },\n" +
                "    { \"type\": \"Feature\",\n" +
                "      \"geometry\": {\n" +
                "        \"type\": \"LineString\",\n" +
                "        \"coordinates\": [\n" +
                "          [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]\n" +
                "          ]\n" +
                "        },\n" +
                "      \"properties\": {\n" +
                "        \"prop0\": \"value0\",\n" +
                "        }\n" +
                "     }\n" +
                "     ]\n" +
                "   }";
        FieldMap aFieldMap = new FieldMap(someGeoJSON);
        assertNotNull(aFieldMap.getFeatureCollection());
    }
}

@@ -195,16 +195,45 @@
 ception;
+%0Aimport java.io.StringReader;
 %0A%0Aimport
@@ -1421,10 +1421,1150 @@
 ;%0A    %7D%0A
+%0A    @Test%0A    public void itShouldNotBarfOnValidReader() throws IOException %7B%0A        String someGeoJSON = %22%7B %5C%22type%5C%22: %5C%22FeatureCollection%5C%22,%5Cn%22 +%0A                %22  %5C%22features%5C%22: %5B%5Cn%22 +%0A                %22    %7B %5C%22type%5C%22: %5C%22Feature%5C%22,%5Cn%22 +%0A                %22      %5C%22geometry%5C%22: %7B%5C%22type%5C%22: %5C%22Point%5C%22, %5C%22coordinates%5C%22: %5B102.0, 0.5%5D%7D,%5Cn%22 +%0A                %22      %5C%22properties%5C%22: %7B%5C%22prop0%5C%22: %5C%22value0%5C%22%7D%5Cn%22 +%0A                %22      %7D,%5Cn%22 +%0A                %22    %7B %5C%22type%5C%22: %5C%22Feature%5C%22,%5Cn%22 +%0A                %22      %5C%22geometry%5C%22: %7B%5Cn%22 +%0A                %22        %5C%22type%5C%22: %5C%22LineString%5C%22,%5Cn%22 +%0A                %22        %5C%22coordinates%5C%22: %5B%5Cn%22 +%0A                %22          %5B102.0, 0.0%5D, %5B103.0, 1.0%5D, %5B104.0, 0.0%5D, %5B105.0, 1.0%5D%5Cn%22 +%0A                %22          %5D%5Cn%22 +%0A                %22        %7D,%5Cn%22 +%0A                %22      %5C%22properties%5C%22: %7B%5Cn%22 +%0A                %22        %5C%22prop0%5C%22: %5C%22value0%5C%22,%5Cn%22 +%0A                %22        %7D%5Cn%22 +%0A                %22     %7D%5Cn%22 +%0A                %22     %5D%5Cn%22 +%0A                %22   %7D%22;%0A        FieldMap aFieldMap = new FieldMap(new StringReader(someGeoJSON));%0A        assertNotNull(aFieldMap.getFeatureCollection());%0A    %7D%0A%0A
 %7D%0A

test the Reader constructor of FieldMapTest