0

I am using Spring Restdocs for documentation. Here's my code:

RestDocumentationResultHandler document = document("{class-name}/{method-name}",
    preprocessRequest(prettyPrint()),
    preprocessResponse(prettyPrint()));

String authHead = TestUtils.performLogin(mockMvc, "user", "pass");
mockMvc
    .perform(get("/svc/service")
    )
    .andExpect(status().is(200))
    .andExpect(content().contentType("application/json;charset=UTF-8"))
    .andExpect(jsonPath("$.childs").isArray())
    .andDo(document);
 }

.adoc files are successfully generated and af there's an error that I am struggling to solve it.

[Fatal Error] :1:1: Premature end of file.
ERROR:  'Premature end of file.'

I think the problem comes from

preprocessResponse(prettyPrint())

Since i commented it out, the error disappears. But JSON response is NOT formated as i expected. I really appreciate your help. Thanks in advance.

Howard Ho
  • 51
  • 1
  • 5
  • It's difficult to know what's going on without seeing some more code. Can you provide a complete example that reproduces the problem? – Andy Wilkinson May 18 '16 at 22:00
  • Sorry for that. Could you possibly have a look at this source code: https://dl.dropboxusercontent.com/u/64513069/MenuResourceTest.java – Howard Ho May 19 '16 at 12:11
  • Hello Andy, I can solve the problem now. Since I put a preprocessRequest(prettyPrint()) but there's no JSON data as request fields or vice versa. Thank you so much for you time spent on my issue. – Howard Ho May 19 '16 at 13:07

0 Answers0