### Question:
ResourceAttributeUtil { public ResourceAttribute fromJSON(String json) throws EntitlementException { try { return (ResourceAttribute) mapper.readValue(getJSON(json), getClass(json)); } catch (IOException e) { throw new EntitlementException(JSON_PARSE_ERROR, e); } } ResourceAttributeUtil();   ResourceAttributeUtil(ObjectMapper mapper); String toJSON(ResourceAttribute attribute); ResourceAttribute fromJSON(String json); static final int JSON_PARSE_ERROR; static final String SEP; }### Answer:
@Test public void shouldCatchFailureIfDeserialisationFails() throws IOException { ObjectMapper mockMapper = mock(ObjectMapper.class); given(mockMapper.readValue(anyString(), any(Class.class))).willThrow(new IOException()); util = new ResourceAttributeUtil(mockMapper); try { util.fromJSON(""); fail(); } catch (EntitlementException e) { assertThat(e).isNotNull(); } }