本文整理了Java中io.restassured.response.Response.contentType
方法的一些代码示例,展示了Response.contentType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.contentType
方法的具体详情如下:
包路径:io.restassured.response.Response
类名称:Response
方法名:contentType
暂无
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetFileVariableDownloadWithTypeAndEncoding() {
String variableKey = "aVariableKey";
final byte[] byteContent = "some bytes".getBytes();
String filename = "test.txt";
String encoding = "UTF-8";
FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.toString()).encoding(encoding).create();
when(taskServiceMock.getVariableLocalTyped(eq(EXAMPLE_TASK_ID), eq(variableKey), anyBoolean())).thenReturn(variableValue);
Response response = given()
.pathParam("id", EXAMPLE_TASK_ID)
.pathParam("varId", variableKey)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.body(is(equalTo(new String(byteContent))))
.when().get(SINGLE_TASK_SINGLE_BINARY_VARIABLE_URL);
String contentType = response.contentType().replaceAll(" ", "");
assertThat(contentType, is(ContentType.TEXT + ";charset=" + encoding));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetFileVariableDownloadWithTypeAndEncoding() {
String variableKey = "aVariableKey";
final byte[] byteContent = "some bytes".getBytes();
String filename = "test.txt";
String encoding = "UTF-8";
FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.toString()).encoding(encoding).create();
when(caseServiceMock.getVariableTyped(eq(MockProvider.EXAMPLE_CASE_INSTANCE_ID), eq(variableKey), anyBoolean()))
.thenReturn(variableValue);
Response response = given()
.pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID)
.pathParam("varId", variableKey)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.body(is(equalTo(new String(byteContent))))
.when().get(SINGLE_CASE_EXECUTION_BINARY_VARIABLE_URL);
String contentType = response.contentType().replaceAll(" ", "");
assertThat(contentType, is(ContentType.TEXT + ";charset=" + encoding));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetFileVariableDownloadWithTypeAndEncoding() {
String variableKey = "aVariableKey";
final byte[] byteContent = "some bytes".getBytes();
String filename = "test.txt";
String encoding = "UTF-8";
FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.toString()).encoding(encoding).create();
when(caseServiceMock.getVariableTyped(eq(MockProvider.EXAMPLE_CASE_INSTANCE_ID), eq(variableKey), anyBoolean()))
.thenReturn(variableValue);
Response response = given()
.pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID)
.pathParam("varId", variableKey)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.body(is(equalTo(new String(byteContent))))
.when().get(SINGLE_CASE_INSTANCE_BINARY_VARIABLE_URL);
String contentType = response.contentType().replaceAll(" ", "");
assertThat(contentType, is(ContentType.TEXT + ";charset=" + encoding));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetFileVariableDownloadWithTypeAndEncoding() {
String variableKey = "aVariableKey";
final byte[] byteContent = "some bytes".getBytes();
String filename = "test.txt";
String encoding = "UTF-8";
FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.toString()).encoding(encoding).create();
when(runtimeServiceMock.getVariableTyped(eq(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID), eq(variableKey), anyBoolean()))
.thenReturn(variableValue);
Response response = given()
.pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)
.pathParam("varId", variableKey)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.body(is(equalTo(new String(byteContent))))
.when().get(SINGLE_PROCESS_INSTANCE_BINARY_VARIABLE_URL);
String contentType = response.contentType().replaceAll(" ", "");
assertThat(contentType, is(ContentType.TEXT + ";charset=" + encoding));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetFileVariableDownloadWithTypeAndEncoding() {
String variableKey = "aVariableKey";
final byte[] byteContent = "some bytes".getBytes();
String filename = "test.txt";
String encoding = "UTF-8";
FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.toString()).encoding(encoding).create();
when(taskServiceMock.getVariableTyped(eq(EXAMPLE_TASK_ID), eq(variableKey), anyBoolean())).thenReturn(variableValue);
Response response = given()
.pathParam("id", EXAMPLE_TASK_ID)
.pathParam("varId", variableKey)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.body(is(equalTo(new String(byteContent))))
.when().get(SINGLE_TASK_SINGLE_BINARY_VARIABLE_URL);
String contentType = response.contentType().replaceAll(" ", "");
assertThat(contentType, is(ContentType.TEXT + ";charset=" + encoding));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetFileVariableDownloadWithTypeAndEncoding() {
String variableKey = "aVariableKey";
final byte[] byteContent = "some bytes".getBytes();
String filename = "test.txt";
String encoding = "UTF-8";
FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.toString()).encoding(encoding).create();
when(runtimeServiceMock.getVariableLocalTyped(eq(MockProvider.EXAMPLE_EXECUTION_ID), eq(variableKey), anyBoolean())).thenReturn(variableValue);
Response response = given()
.pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID)
.pathParam("varId", variableKey)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.body(is(equalTo(new String(byteContent))))
.when().get(SINGLE_EXECUTION_LOCAL_BINARY_VARIABLE_URL);
String contentType = response.contentType().replaceAll(" ", "");
assertThat(contentType, is(ContentType.TEXT + ";charset=" + encoding));
}
代码示例来源:origin: epam/JDI
public RestResponse(Response raResponse, long time) {
this.raResponse = raResponse;
responseTimeMSec = time;
body = raResponse.body().asString();
status = new ResponseStatus(raResponse);
contenType = raResponse.contentType();
logger.info(toString());
}
public RestResponse set(JActionT<RestResponse> valueFunc) {
内容来源于网络,如有侵权,请联系作者删除!