io.restassured.response.Response.contentType()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中io.restassured.response.Response.contentType方法的一些代码示例,展示了Response.contentType的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.contentType方法的具体详情如下:
包路径:io.restassured.response.Response
类名称:Response
方法名:contentType

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) {

相关文章