In my test class I can use @BeforeAll
to annotate a setup method e.g.
@BeforeAll
public void setUp(WebApplicationContext webApplicationContext, RestDocumentationContextProvider restDocumentation) {
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
.apply(documentationConfiguration(restDocumentation)).build();
}
I want to do the same thing in an extension with the BeforeAllCallback
e.g.
public class MyExtension implements BeforeAllCallback {
@Override
public void beforeAll(ExtensionContext context) throws Exception {
// same as above, but I can not have RestDocumentationContextProvider in the signature or WebApplicationContext
}
}
In the extension beforeAll
there is no support for ParameterResolvers
which means I can not use the signature ExtensionContext context, RestDocumentationContextProvider restDocumentation
.
What is the difference between the annotation and the callback method? How can I get an instance of RestDocumentationContextProvider
in my extensions beforeAll method?