@Test @SuppressWarnings("unchecked") public void customMediaType() throws IOException { this.expectedSnippet.expectWireMockJson("custom-mediatype").withContents((Matcher<String>) sameJSONAs(new ObjectMapper().writeValueAsString( of( "request", of("method", "GET", "urlPath", "/foo", "headers", of("Accept", of("contains", "json"))), "response", of("headers", emptyMap(), "body", "", "status", 200)) ))); wiremockJson().document(operationBuilder("custom-mediatype").request("http: .header("Accept", "application/com.carlosjgp.myservice+json; version=1.0").build()); }
@Override public void document(Operation operation) throws IOException { RestDocumentationContext context = (RestDocumentationContext) operation.getAttributes() .get(RestDocumentationContext.class.getName()); WriterResolver writerResolver = new StandardWriterResolver( new RestDocumentationContextPlaceholderResolverFactory(), "UTF-8", TEMPLATE_FORMAT); try (Writer writer = writerResolver.resolve(operation.getName(), SNIPPET_NAME, context)) { writer.append(toJsonString(operation)); } }
WireMockJsonSnippet implements Snippet { @Override public void document(Operation operation) throws IOException { RestDocumentationContext context = (RestDocumentationContext) operation.getAttributes() .get(RestDocumentationContext.class.getName()); WriterResolver writerResolver = new StandardWriterResolver( new RestDocumentationContextPlaceholderResolverFactory(), "UTF-8", TEMPLATE_FORMAT); try (Writer writer = writerResolver.resolve(operation.getName(), SNIPPET_NAME, context)) { writer.append(toJsonString(operation)); } } }
WireMockJsonSnippet implements Snippet { @Override public void document(Operation operation) throws IOException { RestDocumentationContext context = (RestDocumentationContext) operation.getAttributes() .get(RestDocumentationContext.class.getName()); WriterResolver writerResolver = new StandardWriterResolver( new RestDocumentationContextPlaceholderResolverFactory(), "UTF-8", TEMPLATE_FORMAT); try (Writer writer = writerResolver.resolve(operation.getName(), SNIPPET_NAME, context)) { writer.append(toJsonString(operation)); } } WireMockJsonSnippet(ResponseFieldTemplateDescriptor[] responseFieldTemplateDescriptors); }
WireMockJsonSnippet implements Snippet { @Override public void document(Operation operation) throws IOException { RestDocumentationContext context = (RestDocumentationContext) operation.getAttributes() .get(RestDocumentationContext.class.getName()); WriterResolver writerResolver = new StandardWriterResolver( new RestDocumentationContextPlaceholderResolverFactory(), "UTF-8", TEMPLATE_FORMAT); try (Writer writer = writerResolver.resolve(operation.getName(), SNIPPET_NAME, context)) { writer.append(toJsonString(operation)); } } WireMockJsonSnippet(ResponseFieldTemplateDescriptor[] responseFieldTemplateDescriptors); @Override void document(Operation operation); }
WireMockJsonSnippet implements Snippet { @Override public void document(Operation operation) throws IOException { RestDocumentationContext context = (RestDocumentationContext) operation.getAttributes() .get(RestDocumentationContext.class.getName()); WriterResolver writerResolver = new StandardWriterResolver( new RestDocumentationContextPlaceholderResolverFactory(), "UTF-8", TEMPLATE_FORMAT); try (Writer writer = writerResolver.resolve(operation.getName(), SNIPPET_NAME, context)) { writer.append(toJsonString(operation)); } } WireMockJsonSnippet(ResponseFieldTemplateDescriptor[] responseFieldTemplateDescriptors); @Override void document(Operation operation);  }