@Test(expected = IllegalArgumentException.class) public void testparseFeatureArrayError() { FeatureJsonParser.parseFeatureArray("something:invalid"); }
@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); } }
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); } } }
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(); }
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); }
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);  }