Example usage for org.springframework.restdocs.operation Parameters Parameters

List of usage examples for org.springframework.restdocs.operation Parameters Parameters

Introduction

In this page you can find the example usage for org.springframework.restdocs.operation Parameters Parameters.

Prototype

Parameters

Source Link

Usage

From source file:io.github.restdocsext.jersey.operation.preprocess.BinaryPartPlaceholderOperationPreprocessorTest.java

@Test
public void replace_binary_multipart_content_with_placeholder() {
    OperationRequestPart part1 = this.partFactory.create("field1", "file1.png", "BinaryContent".getBytes(),
            new HttpHeaders());
    OperationRequestPart part2 = this.partFactory.create("field2", null, "TextContent".getBytes(),
            new HttpHeaders());
    final OperationRequest request = this.requestFactory.create(URI.create("http://localhost"), HttpMethod.POST,
            null, new HttpHeaders(), new Parameters(), Arrays.asList(part1, part2));

    this.preprocessor.field("field1", "<<placeholder>>");
    final OperationRequest preprocessed = this.preprocessor.preprocess(request);
    final Collection<OperationRequestPart> parts = preprocessed.getParts();
    assertThat(hasPart(parts, "field1", "<<placeholder>>"), is(true));
    assertThat(hasPart(parts, "field2", "TextContent"), is(true));
}

From source file:io.github.restdocsext.jersey.operation.preprocess.BinaryPartPlaceholderOperationPreprocessorTest.java

@Test
public void replace_binary_multipart_content_with_default_placeholder() {
    OperationRequestPart part1 = this.partFactory.create("field1", "file1.png", "BinaryContent".getBytes(),
            new HttpHeaders());
    OperationRequestPart part2 = this.partFactory.create("field2", null, "TextContent".getBytes(),
            new HttpHeaders());
    final OperationRequest request = this.requestFactory.create(URI.create("http://localhost"), HttpMethod.POST,
            null, new HttpHeaders(), new Parameters(), Arrays.asList(part1, part2));

    this.preprocessor.field("field1");
    final OperationRequest preprocessed = this.preprocessor.preprocess(request);
    final Collection<OperationRequestPart> parts = preprocessed.getParts();
    assertThat(hasPart(parts, "field1", "<<binary data>>"), is(true));
    assertThat(hasPart(parts, "field2", "TextContent"), is(true));
}