Skip to content

Question: How to share documentation snippets for multiple tests #255

@Koizumi85

Description

@Koizumi85

Hello,

in 1.0.0.RELEASE it was possible to build a RestDocumentationResultHandler with some standard snippets in the a @Before method of an abstract test class and then extend this in the test methods like in the following gist:

https://gist.github.com/Koizumi85/99c71e3b07a4dfbfb27def47351132e5

With 1.1.0.RELEASE you deprecated the RestDocumentationResultHandler.snippets() method and provided RestDocumentationResultHandler.document() instead.

The new one creates a new RestDocumentationResultHandler instance and therefore if I simply replace .snippets(...) with .document(...) it doesn't work, because my .alwaysDo(this.document) in the abstract class' setup method, got the old instance of the RestDocumentationResultHandler.

As a workaround I can remove the .alwaysDo() in the abstract class and put an andDo() in each test method. But it feels kind of dirty compared to the old way. So is there another way to do this in 1.1.0.RELEASE now?

Greetings

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions