-
Notifications
You must be signed in to change notification settings - Fork 740
Description
Trying to use spring-restdocs but it is tightly coupled to JUnit. The main issue is in RestDocumentation which implements TestRule (JUnit specific). The apply method returns a wrapper to the provided statement that when evaluated sets up the context, runs the test and then sets the context back to null. When running the test in TestNG, I get a NullPointerException in the beforeOperation method since the context is never created.
I used reflection to make the context accessible and assigned it a value myself and the test runs properly but it is a hack solution. Simple solution would be to provide a way for the test to manually tell the RestDocumentation that it has started or stopped (and maybe provide a TestNG listener that uses it) or make context accessible. It would be better if the JUnit code lived one layer deeper so if JUnit isn't on the classpath so it can detect TestNG and utilize it's listeners instead.