### Question:
WeightedMobSpawnGroup { public static List<WeightedMobSpawnGroup> fromJson(String originalJson) throws InvalidConfigException { List<WeightedMobSpawnGroup> mobGroups = new ArrayList<WeightedMobSpawnGroup>(); String json = originalJson.trim(); if (json.length() <= 2) { return mobGroups; } json = removeFirstAndLastChar(json); json = json.replace('{', '('); json = json.replace('}', ')'); String[] groups = StringHelper.readCommaSeperatedString(json); for (String group : groups) { mobGroups.add(readSingleGroup(group)); } return mobGroups; } WeightedMobSpawnGroup(String mobName, int weight, int min, int max);  WeightedMobSpawnGroup(MobNames mobName, int weight, int min, int max); String getInternalName(); String getConfigName(); int getWeight(); int getMin(); int getMax(); static List<WeightedMobSpawnGroup> fromJson(String originalJson); static String toJson(List<WeightedMobSpawnGroup> list); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testMalformedJSON() throws InvalidConfigException { String[] tests = { "[{\"mob\": \"Creeper\": \"Invalid\", \"min\": 3, \"max\": 4, \"weight\": 10}]", "[{\"mob\":, \"min\": 3, \"max\": 4, \"weight\": 10}]", "[{\"mob\", \"min\": 3, \"max\": 4, \"weight\": 10}]", "{\"mob\", \"min\": 3, \"max\": 4, \"weight\": 10}" }; for (String test : tests) { try { fromJson(test); fail("String was invalid, so fromJson should have thrown an exception"); } catch (InvalidConfigException expected) { } } }