List of usage examples for org.springframework.restdocs.generate RestDocumentationGenerator ATTRIBUTE_NAME_DEFAULT_SNIPPETS
String ATTRIBUTE_NAME_DEFAULT_SNIPPETS
To view the source code for org.springframework.restdocs.generate RestDocumentationGenerator ATTRIBUTE_NAME_DEFAULT_SNIPPETS.
Click Source Link
From source file:io.github.restdocsext.jersey.JerseyRestDocumentationConfigurerTest.java
@Test public void configuration_is_added_to_the_context() throws Exception { this.configurer.filter(this.requestContext, this.responseContext); @SuppressWarnings("unchecked") Map<String, Object> configuration = getContextProperty(this.requestContext, DocumentationProperties.CONTEXT_CONFIGURATION_KEY, Map.class); assertThat(configuration, is(notNullValue())); assertThat(configuration,/* w w w . java2 s . c o m*/ hasEntry(equalTo(TemplateEngine.class.getName()), instanceOf(TemplateEngine.class))); assertThat(configuration, hasEntry(equalTo(WriterResolver.class.getName()), instanceOf(WriterResolver.class))); assertThat(configuration, hasEntry(equalTo(RestDocumentationGenerator.ATTRIBUTE_NAME_DEFAULT_SNIPPETS), instanceOf(List.class))); }
From source file:io.github.restdocsext.jersey.JerseyRestDocumentationFilter.java
/** * Create a new {@link JerseyRestDocumentationFilter} that will produce documentation * with the provided snippets./*from w ww. ja va 2 s . c om*/ * * @param snippets the snippets to add * @return a new Jersey documentation filter. */ public JerseyRestDocumentationFilter document(Snippet... snippets) { return new JerseyRestDocumentationFilter(this.delegate.withSnippets(snippets)) { @SuppressWarnings("unchecked") @Override public void filter(ClientRequestContext request, ClientResponseContext response) throws IOException { final Map<String, Object> configuration = new HashMap<>( getContextProperty(request, CONTEXT_CONFIGURATION_KEY, Map.class)); configuration.remove(RestDocumentationGenerator.ATTRIBUTE_NAME_DEFAULT_SNIPPETS); super.filter(request, response); } }; }