@Test public void testException() { ErrorMessageHeaderWriter writer = new ErrorMessageHeaderWriter(); try { writer.writeObject(null, null); } catch (ErrorMessageHeaderSerializationException e) { String message = e.getMessage(); Assert.assertTrue(message.startsWith("Could not serialize ")); } }
@Override public void writeObject(ErrorMessageHeader errorMessageHeader, OutputStream outputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { mapper.writeValue(outputStream, errorMessageHeader); } catch (Exception e) { String message = "Could not serialize a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } }
ErrorMessageHeaderWriter implements SerializationWriter<ErrorMessageHeader> { @Override public void writeObject(ErrorMessageHeader errorMessageHeader, OutputStream outputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { mapper.writeValue(outputStream, errorMessageHeader); } catch (Exception e) { String message = "Could not serialize a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } } }
ErrorMessageHeaderWriter implements SerializationWriter<ErrorMessageHeader> { @Override public void writeObject(ErrorMessageHeader errorMessageHeader, OutputStream outputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { mapper.writeValue(outputStream, errorMessageHeader); } catch (Exception e) { String message = "Could not serialize a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } }  }
ErrorMessageHeaderWriter implements SerializationWriter<ErrorMessageHeader> { @Override public void writeObject(ErrorMessageHeader errorMessageHeader, OutputStream outputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { mapper.writeValue(outputStream, errorMessageHeader); } catch (Exception e) { String message = "Could not serialize a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } }  @Override void writeObject(ErrorMessageHeader errorMessageHeader, OutputStream outputStream); }
ErrorMessageHeaderWriter implements SerializationWriter<ErrorMessageHeader> { @Override public void writeObject(ErrorMessageHeader errorMessageHeader, OutputStream outputStream) throws ErrorMessageHeaderSerializationException { ObjectMapper mapper = new ObjectMapper(); try { mapper.writeValue(outputStream, errorMessageHeader); } catch (Exception e) { String message = "Could not serialize a " + ErrorMessageHeader.class.getName() + " object. Cause: " + e.getMessage(); throw new ErrorMessageHeaderSerializationException(message, e); } }  @Override void writeObject(ErrorMessageHeader errorMessageHeader, OutputStream outputStream);  }