### Question:
Asset { public void fromJson(String json) throws IOException { this.attributes.clear(); this.photos.clear(); JsonFactory f = new JsonFactory(); JsonParser p = f.createJsonParser(json); while (p.nextToken() != JsonToken.END_OBJECT) { String field = p.getCurrentName(); if ("id".equals(field)) { p.nextToken(); String id = p.getText(); this.id = id; } else if ("code".equals(field)) { p.nextToken(); String code = p.getText(); this.code = code; } else if ("name".equals(field)) { p.nextToken(); String name = p.getText(); this.name = name; } else if ("tags".equals(field)) { p.nextToken(); while (p.nextToken() != JsonToken.END_ARRAY) { String tag = p.getText(); this.tags.add(tag); } } else if ("attributes".equals(field)) { p.nextToken(); while (p.nextToken() != JsonToken.END_OBJECT) { String attribute = p.getCurrentName(); p.nextToken(); String value = p.getText(); this.attributes.put(attribute, value); } } else if ("photos".equals(field)) { p.nextToken(); while (p.nextToken() != JsonToken.END_ARRAY) { String url = p.getText(); this.addPhoto(url); } } else { } } } Asset(); static String toJson(Collection<Asset> assets); static Set<URI> getPhotosToRemove(Asset original, Asset updated); String getId(); void setId(String id); String getCode(); void setCode(String code); String getName(); void setName(String name); Set<String> getTags(); Map<String, String> getAttributes(); Set<URI> getPhotos(); void addPhoto(String url); void fromJson(String json); String toJson();  }### Answer:
@Test public void testFromJson() { try { Asset asset = new Asset(); asset.fromJson(this.json); assertEquals("TJI Joists", asset.getName()); assertTrue(asset.getTags().contains("Flooring")); assertTrue(asset.getTags().contains("Featured")); assertTrue(asset.getPhotos().contains(new URI("http: assertTrue(asset.getAttributes().containsKey("Quantity")); assertEquals("Excellent", asset.getAttributes().get("Condition")); } catch (IOException e) { fail(e.toString()); } catch (URISyntaxException e) { fail(e.toString()); } }