@Test
public void testGetGeoJSONInput() throws Exception {

    String ID_PREFIX = "testing";
    assertNull("Null input should produce null as GeoJSON", AnalysisParser.getGeoJSONInput(null, ID_PREFIX));
    JSONObject input = new JSONObject();
    JSONArray features = new JSONArray();
    input.putOpt("features", features);
    assertTrue("Empty features array in input should produce empty feature collection", JSONHelper.isEqual(getFeatureCollection(), new JSONObject(AnalysisParser.getGeoJSONInput(input, "testing"))));
    // test with one feature
    JSONObject firstFeature = generateFeature(false);
    features.put(firstFeature);
    JSONObject testFeature1 = copyFeature(firstFeature, ID_PREFIX + ".0");
    assertTrue("Feature in input should produce feature collection with overridden id",
            JSONHelper.isEqual(getFeatureCollection(testFeature1), new JSONObject(AnalysisParser.getGeoJSONInput(input, ID_PREFIX))));
    // test with two features with one having "crs" key
    JSONObject secondFeature = generateFeature(true);
    JSONObject testFeature2 = copyFeature(secondFeature, ID_PREFIX + ".1");
    // getGeoJSONInput() removes crs key no matter the value
    testFeature2.remove("crs");
    features.put(secondFeature);
    assertTrue("Feature with CRS in input should produce feature collection with overridden ids and cleaned up features",
            JSONHelper.isEqual(getFeatureCollection(testFeature1, testFeature2), new JSONObject(AnalysisParser.getGeoJSONInput(input, ID_PREFIX))));
}