@SuppressWarnings("unchecked") @Test public void postRequest() throws IOException { this.expectedSnippet.expectWireMockJson("post-request").withContents((Matcher<String>) sameJSONAs(new ObjectMapper().writeValueAsString( of( "request", of("method", "POST", "urlPath", "/", "headers", of("Content-Type", of("contains", "uri-list"))), "response", of("headers", of("Content-Length", "16", "Content-Type", "text/plain"), "body", "response-content", "status", 200))))); OperationBuilder operationBuilder = operationBuilder("post-request"); operationBuilder.response().content("response-content").header("Content-Type", "text/plain").build(); wiremockJson().document(operationBuilder.request("http: .header("Content-Type", "text/uri-list").content("http: }
@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);  }