@SuppressWarnings("unchecked") @Test public void simpleRequestWithUriTemplateAndResponseTemplate1() throws IOException { this.expectedSnippet.expectWireMockJson("simple-request") .withContents((Matcher<String>) sameJSONAs( new ObjectMapper().writeValueAsString(expectedJsonForSimpleRequestWithUrlPatternAndResponseTemplate()))); OperationBuilder operationBuilder = operationBuilder("simple-request") .attribute(ATTRIBUTE_NAME_URL_TEMPLATE, "http: operationBuilder.request("http: .method("GET").build(); operationBuilder.response().status(200).content("{\"id\": \"some\"}"); wiremockJson(idFieldReplacedWithPathParameterValue()) .document(operationBuilder.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);  }