use of io.restassured.builder.MultiPartSpecBuilder in project rest-assured by rest-assured.
the class MultiPartITest method textUploadingWhenUsingMultiPartSpecificationAndCharset.
@Test
public void textUploadingWhenUsingMultiPartSpecificationAndCharset() throws Exception {
// Given
final String string = IOUtils.toString(getClass().getResourceAsStream("/car-records.xsd"));
// When
given().multiPart(new MultiPartSpecBuilder(string).with().charset("UTF-8").and().with().controlName("other").and().with().mimeType("application/vnd.some+json").build()).expect().statusCode(200).body(is(string)).when().post("/multipart/string");
}
use of io.restassured.builder.MultiPartSpecBuilder in project rest-assured by rest-assured.
the class MultiPartITest method fileNameInMultiPartSpecBuilderHasPrecedenceOverDefault.
@Test
public void fileNameInMultiPartSpecBuilderHasPrecedenceOverDefault() throws Exception {
// Given
final InputStream is = getClass().getResourceAsStream("/car-records.xsd");
// When
given().multiPart(new MultiPartSpecBuilder(is).fileName("file2").build()).when().post("/multipart/filename").then().statusCode(200).body(equalTo("file2"));
}
use of io.restassured.builder.MultiPartSpecBuilder in project rest-assured by rest-assured.
the class MultiPartUploadITest method multiPartObjectMapperTypeHavePrecedenceOverMimeType.
@Test
public void multiPartObjectMapperTypeHavePrecedenceOverMimeType() throws Exception {
// Given
final Greeting greeting = new Greeting();
greeting.setFirstName("John");
greeting.setLastName("Doe");
// When
given().multiPart(new MultiPartSpecBuilder(greeting, ObjectMapperType.JAXB).fileName("RoleBasedAccessFeaturePlan.csv").controlName("text").mimeType("application/json").build()).when().post("/multipart/text").then().statusCode(200).body(containsString("John"), containsString("Doe"), containsString("<"));
}
Aggregations