### Question:
Spec { public Map<String, DeclaredType> getTypes() { return types; } Spec(); String getName(); Spec setName(String name); Map<String, DeclaredType> getTypes(); Map<String, Input> getInputs(); List<Rule> getRules(); Spec setRules(List<Rule> rules); String getOutput(); void setOutput(String output); void validateType(String type); boolean isValidType(String type); boolean mustParse(String input, String field); static final String FIELD_NAME; static final String FIELD_TYPES; static final String FIELD_INPUTS; static final String FIELD_RULES; static final String FIELD_OUTPUT; }### Answer:
@Test public void testParseDeclare() throws IOException { JsonObject json = Json.createObjectBuilder() .add(Spec.FIELD_INPUTS, Json.createArrayBuilder()) .add(Spec.FIELD_TYPES, buildTypes()) .add(Spec.FIELD_OUTPUT, FieldType.STRING.getValue()) .build(); Spec spec = parseSpec(json); assertNotNull(spec); assertFalse(spec.getTypes().isEmpty()); assertEquals(FieldType.STRING, spec.getTypes().get("Person").getDefinition().get("name")); assertEquals(FieldType.INTEGER, spec.getTypes().get("Person").getDefinition().get("age")); }