### Question:
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for (LinkedHashMap<String, Object> ll : flipMap) { fArray[idx++] = parseFeatureMap(ll); } return fArray; } catch (Exception e) { throw new IllegalArgumentException("Cannot parse JSON " + json, e); } } private  FeatureJsonParser(); @SuppressWarnings("unchecked") static Feature parseFeature(String json); @SuppressWarnings("unchecked") static Set<String> parsePermissions(String json); static String featureArrayToJson(Feature[] features); @SuppressWarnings("unchecked") static FlippingStrategy parseFlipStrategyAsJson(String uid, String json); @SuppressWarnings("unchecked") static FlippingStrategy parseFlipStrategy(String uid, Map<String, Object> flipMap); @SuppressWarnings("unchecked") static Feature[] parseFeatureArray(String json);  }### Answer:
@Test public void testArrays() throws Exception { Map <String, Feature> features = ff4j.getFeatures(); int idx = 0; Feature[] f= new Feature[features.size()]; for (String feature : features.keySet()) { f[idx] = features.get(feature); idx++; } String featuresArrayAsJson = marshallWithJackson(f); Feature[] ff = FeatureJsonParser.parseFeatureArray(featuresArrayAsJson); Assert.assertEquals(ff4j.getFeatures().size(), ff.length); }
@Test(expected = IllegalArgumentException.class) public void testparseFeatureArrayError() { FeatureJsonParser.parseFeatureArray("something:invalid"); }
@Test public void testparseFeatureArrayEmpty() { Assert.assertNull(FeatureJsonParser.parseFeatureArray(null)); Assert.assertNull(FeatureJsonParser.parseFeatureArray("")); }