Print Jersey JSON in Unit Testing

后端 未结 1 1067
一个人的身影
一个人的身影 2021-01-18 11:56

Is there any plain way

  • to print a JAXB annotated instance
  • in JSON format (as exactly jersey will print in AS)
  • while running unit testing
相关标签:
1条回答
  • 2021-01-18 12:20

    It is possible:

    ...
    StringWriter writer = new StringWriter();
    marshaller.marshallToJSON(objectToMarshall, writer)
    logger.debug(writer.toString());
    ...
    

    You can use an StringWriter to take the String representation of the marshalled JSON output.

    0 讨论(0)
提交回复
热议问题