@Test public void testReadErrorMessageHeaderFromString() { InputStream inputJsonStream = getClass().getClassLoader().getResourceAsStream("errors/serialization/errormessageheader.json"); String inputJson = null; try { inputJson = ReadFile.getFileContents(inputJsonStream).toString(); } catch (IOException e) { e.printStackTrace(); } ErrorMessageHeader actualErrorMessageHeader = new ErrorMessageHeaderReader().readObject(inputJson); ErrorMessageHeader expectedErrorMessageHeader = new ErrorMessageHeader("microservice-1-uri", 1456485443905L, 404, "Service unavailable"); Assert.assertEquals("Unexpected error message header", expectedErrorMessageHeader, actualErrorMessageHeader); }
@NoJavadoc @Override public ErrorMessageHeader readObject(InputStream inputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(inputStream, ErrorMessageHeader.class); } catch (Exception e) { String message = "Could not deserialize input into a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } }
ErrorMessageHeaderReader implements SerializationReader<ErrorMessageHeader> { @NoJavadoc @Override public ErrorMessageHeader readObject(InputStream inputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(inputStream, ErrorMessageHeader.class); } catch (Exception e) { String message = "Could not deserialize input into a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } } }
ErrorMessageHeaderReader implements SerializationReader<ErrorMessageHeader> { @NoJavadoc @Override public ErrorMessageHeader readObject(InputStream inputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(inputStream, ErrorMessageHeader.class); } catch (Exception e) { String message = "Could not deserialize input into a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } }  }
ErrorMessageHeaderReader implements SerializationReader<ErrorMessageHeader> { @NoJavadoc @Override public ErrorMessageHeader readObject(InputStream inputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(inputStream, ErrorMessageHeader.class); } catch (Exception e) { String message = "Could not deserialize input into a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } }  @NoJavadoc @Override ErrorMessageHeader readObject(InputStream inputStream); @NoJavadoc @Override ErrorMessageHeader readObject(Reader reader); @NoJavadoc ErrorMessageHeader readObject(String content); }
ErrorMessageHeaderReader implements SerializationReader<ErrorMessageHeader> { @NoJavadoc @Override public ErrorMessageHeader readObject(InputStream inputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(inputStream, ErrorMessageHeader.class); } catch (Exception e) { String message = "Could not deserialize input into a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } }  @NoJavadoc @Override ErrorMessageHeader readObject(InputStream inputStream); @NoJavadoc @Override ErrorMessageHeader readObject(Reader reader); @NoJavadoc ErrorMessageHeader readObject(String content);  }