### Question:
SmsJsonConverter { public Map<String, Set<String>> fromJson(JsonValue jsonValue) throws JsonException, BadRequestException { return fromJson(null, jsonValue); } @Inject  SmsJsonConverter(ServiceSchema schema); JsonValue toJson(Map<String, Set<String>> attributeValuePairs, boolean validate); JsonValue toJson(Map<String, Set<String>> attributeValuePairs, boolean validate, JsonValue parentJson); JsonValue toJson(String realm, Map<String, Set<String>> attributeValuePairs, boolean validate); JsonValue toJson(String realm, Map<String, Set<String>> attributeValuePairs, boolean validate,
            JsonValue parentJson); Map<String, Set<String>> fromJson(JsonValue jsonValue); Map<String, Set<String>> fromJson(String realm, JsonValue jsonValue);  }### Answer:
@Test public void convertFromJson() throws Exception { given(serviceSchema.validateAttributes(Matchers.<Map>anyObject())).willReturn(true); Map<String, Set<String>> result = converter.fromJson(jsonRepresentation); assertThat(result).isEqualTo(mapRepresentation); }
@Test(expectedExceptions = JsonException.class) public void invalidValuesToMap() throws Exception { given(serviceSchema.validateAttributes(Matchers.<Map>anyObject())).willReturn(false); converter.fromJson(jsonRepresentation); }
@Test(expectedExceptions = BadRequestException.class) public void invalidValueTypeResultsInBadRequestException() throws Exception { given(serviceSchema.validateAttributes(any(Map.class))).willReturn(true); converter.fromJson(json(object(field(INT_VALUE_NAME, "blabla")))); }