io.restassured.path.json.JsonPath.getInt()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(13.5k)|赞(0)|评价(0)|浏览(136)

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

JsonPath.getInt介绍

[英]Get the result of an Object path expression as an int.
[中]以int形式获取对象路径表达式的结果。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testTaskCountByCandidateGroupReport() {
 Response response = given()
  .then()
  .expect()
  .statusCode(Status.OK.getStatusCode())
  .contentType(ContentType.JSON)
  .when()
  .get(CANDIDATE_GROUP_REPORT_URL);
 String content = response.asString();
 List<String> reports = from(content).getList("");
 Assert.assertEquals("There should be one report returned.", 1, reports.size());
 Assert.assertNotNull("The returned report should not be null.", reports.get(0));
 String returnedGroup = from(content).getString("[0].groupName");
 int returnedCount = from(content).getInt("[0].taskCount");
 Assert.assertEquals(EXAMPLE_GROUP_ID, returnedGroup);
 Assert.assertEquals(EXAMPLE_TASK_COUNT_BY_CANDIDATE_GROUP, returnedCount);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testReportRetrieval() {
 Response response = given()
 .then().expect()
  .statusCode(Status.OK.getStatusCode())
  .contentType(ContentType.JSON)
 .when().get(HISTORIC_REPORT_URL);
 // assert query invocation
 InOrder inOrder = Mockito.inOrder(historicBatchReport);
 inOrder.verify(historicBatchReport).list();
 String content = response.asString();
 List<String> reportResults = from(content).getList("");
 Assert.assertEquals("There should be two report results returned.", 2, reportResults.size());
 Assert.assertNotNull(reportResults.get(0));
 String returnedBatchType = from(content).getString("[0].batchType");
 int returnedTTL = from(content).getInt("[0].historyTimeToLive");
 long returnedFinishedCount= from(content).getLong("[0].finishedBatchesCount");
 long returnedCleanableCount = from(content).getLong("[0].cleanableBatchesCount");
 Assert.assertEquals(EXAMPLE_TYPE, returnedBatchType);
 Assert.assertEquals(EXAMPLE_TTL, returnedTTL);
 Assert.assertEquals(EXAMPLE_FINISHED_COUNT, returnedFinishedCount);
 Assert.assertEquals(EXAMPLE_CLEANABLE_COUNT, returnedCleanableCount);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testSimpleAuthorizationQuery() {
 List<Authorization> mockAuthorizations = MockProvider.createMockGlobalAuthorizations();
 AuthorizationQuery mockQuery = setUpMockQuery(mockAuthorizations);
 Response response = given().queryParam("type", Authorization.AUTH_TYPE_GLOBAL)
  .then().expect().statusCode(Status.OK.getStatusCode())
  .when().get(SERVICE_PATH);
 InOrder inOrder = inOrder(mockQuery);
 inOrder.verify(mockQuery).authorizationType(Authorization.AUTH_TYPE_GLOBAL);
 inOrder.verify(mockQuery).list();
 String content = response.asString();
 List<String> instances = from(content).getList("");
 Assert.assertEquals("There should be one authorization returned.", 1, instances.size());
 Assert.assertNotNull("The returned authorization should not be null.", instances.get(0));
 Authorization mockAuthorization = mockAuthorizations.get(0);
 Assert.assertEquals(mockAuthorization.getId(), from(content).getString("[0].id"));
 Assert.assertEquals(mockAuthorization.getAuthorizationType(), from(content).getInt("[0].type"));
 Assert.assertEquals(Permissions.READ.getName(), from(content).getString("[0].permissions[0]"));
 Assert.assertEquals(Permissions.UPDATE.getName(), from(content).getString("[0].permissions[1]"));
 Assert.assertEquals(mockAuthorization.getUserId(), from(content).getString("[0].userId"));
 Assert.assertEquals(mockAuthorization.getGroupId(), from(content).getString("[0].groupId"));
 Assert.assertEquals(mockAuthorization.getResourceType(), from(content).getInt("[0].resourceType"));
 Assert.assertEquals(mockAuthorization.getResourceId(), from(content).getString("[0].resourceId"));
}

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedDefinitionKey = from(content).getString("[0].decisionDefinitionKey");
String returnedDefinitionName = from(content).getString("[0].decisionDefinitionName");
int returnedDefinitionVersion = from(content).getInt("[0].decisionDefinitionVersion");
int returnedTTL = from(content).getInt("[0].historyTimeToLive");
long returnedFinishedCount= from(content).getLong("[0].finishedDecisionInstanceCount");
long returnedCleanableCount = from(content).getLong("[0].cleanableDecisionInstanceCount");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedDefinitionKey = from(content).getString("[0].caseDefinitionKey");
String returnedDefinitionName = from(content).getString("[0].caseDefinitionName");
int returnedDefinitionVersion = from(content).getInt("[0].caseDefinitionVersion");
int returnedTTL = from(content).getInt("[0].historyTimeToLive");
long returnedFinishedCount= from(content).getLong("[0].finishedCaseInstanceCount");
long returnedCleanableCount = from(content).getLong("[0].cleanableCaseInstanceCount");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedDefinitionKey = from(content).getString("[0].processDefinitionKey");
String returnedDefinitionName = from(content).getString("[0].processDefinitionName");
int returnedDefinitionVersion = from(content).getInt("[0].processDefinitionVersion");
int returnedTTL = from(content).getInt("[0].historyTimeToLive");
long returnedFinishedCount= from(content).getLong("[0].finishedProcessInstanceCount");
long returnedCleanableCount = from(content).getLong("[0].cleanableProcessInstanceCount");

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testDurationReportByMonth() {
 Response response = given()
   .queryParam("periodUnit", "month")
   .queryParam("reportType", "duration")
  .then()
   .expect()
    .statusCode(Status.OK.getStatusCode())
    .contentType(ContentType.JSON)
   .when()
    .get(HISTORIC_PROCESS_INSTANCE_REPORT_URL);
 String content = response.asString();
 List<String> reports = from(content).getList("");
 Assert.assertEquals("There should be one report returned.", 1, reports.size());
 Assert.assertNotNull("The returned report should not be null.", reports.get(0));
 long returnedAvg = from(content).getLong("[0].average");
 long returnedMax = from(content).getLong("[0].maximum");
 long returnedMin = from(content).getLong("[0].minimum");
 int returnedPeriod = from(content).getInt("[0].period");
 String returnedPeriodUnit = from(content).getString("[0].periodUnit");
 Assert.assertEquals(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_AVG, returnedAvg);
 Assert.assertEquals(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_MAX, returnedMax);
 Assert.assertEquals(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_MIN, returnedMin);
 Assert.assertEquals(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_PERIOD, returnedPeriod);
 Assert.assertEquals(MONTH.toString(), returnedPeriodUnit);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testDurationReportByQuarter() {
 Response response = given()
   .queryParam("periodUnit", "quarter")
   .queryParam("reportType", "duration")
  .then()
   .expect()
    .statusCode(Status.OK.getStatusCode())
    .contentType(ContentType.JSON)
   .when()
    .get(HISTORIC_PROCESS_INSTANCE_REPORT_URL);
 String content = response.asString();
 List<String> reports = from(content).getList("");
 Assert.assertEquals("There should be one report returned.", 1, reports.size());
 Assert.assertNotNull("The returned report should not be null.", reports.get(0));
 long returnedAvg = from(content).getLong("[0].average");
 long returnedMax = from(content).getLong("[0].maximum");
 long returnedMin = from(content).getLong("[0].minimum");
 int returnedPeriod = from(content).getInt("[0].period");
 String returnedPeriodUnit = from(content).getString("[0].periodUnit");
 Assert.assertEquals(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_AVG, returnedAvg);
 Assert.assertEquals(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_MAX, returnedMax);
 Assert.assertEquals(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_MIN, returnedMin);
 Assert.assertEquals(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_PERIOD, returnedPeriod);
 Assert.assertEquals(QUARTER.toString(), returnedPeriodUnit);
}

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedDefinitionName = from(content).getString("[0].name");
String returnedDescription = from(content).getString("[0].description");
int returnedVersion = from(content).getInt("[0].version");
String returnedResourceName = from(content).getString("[0].resource");
String returnedDeploymentId  = from(content).getString("[0].deploymentId");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedExecutionId = from(content).getString("[0].executionId");
String returnedExceptionMessage = from(content).getString("[0].exceptionMessage");
int returnedRetries = from(content).getInt("[0].retries");
Date returnedDueDate = DateTimeUtil.parseDate(from(content).getString("[0].dueDate"));
boolean returnedSuspended = from(content).getBoolean("[0].suspended");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedCategory = from(content).getString("[0].category");
String returnedName = from(content).getString("[0].name");
int returnedVersion = from(content).getInt("[0].version");
String returnedResource = from(content).getString("[0].resource");
String returnedDeploymentId = from(content).getString("[0].deploymentId");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedCategory = from(content).getString("[0].category");
String returnedName = from(content).getString("[0].name");
int returnedVersion = from(content).getInt("[0].version");
String returnedResource = from(content).getString("[0].resource");
String returnedDeploymentId = from(content).getString("[0].deploymentId");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedExternalTaskTopicName = from(content).getString("[0].topicName");
String returnedExternalTaskWorkerId = from(content).getString("[0].workerId");
int returnedRetries = from(content).getInt("[0].retries");
long returnedPriority = from(content).getLong("[0].priority");
String returnedErrorMessage = from(content).getString("[0].errorMessage");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedCategory = from(content).getString("[0].category");
String returnedName = from(content).getString("[0].name");
int returnedVersion = from(content).getInt("[0].version");
String returnedResource = from(content).getString("[0].resource");
String returnedDeploymentId = from(content).getString("[0].deploymentId");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedProcessDefinitionKey = from(content).getString("[0].processDefinitionKey");
String returnedProcessDefinitionName = from(content).getString("[0].processDefinitionName");
int returnedProcessDefinitionVersion= from(content).getInt("[0].processDefinitionVersion");
String returnedStartTime = from(content).getString("[0].startTime");
String returnedEndTime = from(content).getString("[0].endTime");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedExternalTaskTopicName = from(content).getString("[0].topicName");
String returnedExternalTaskWorkerId = from(content).getString("[0].workerId");
int returnedRetries = from(content).getInt("[0].retries");
long returnedPriority = from(content).getLong("[0].priority");
String returnedErrorMessage = from(content).getString("[0].errorMessage");

代码示例来源:origin: camunda/camunda-bpm-platform

String processDefinitionKey = from(content).getString("[0].processDefinitionKey");
String processInstanceId = from(content).getString("[0].processInstanceId");
Integer retries = from(content).getInt("[0].retries");
Boolean suspended = from(content).getBoolean("[0].suspended");
String topicName = from(content).getString("[0].topicName");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedOwner = from(content).getString("[0].owner");
String returnedParentTaskId = from(content).getString("[0].parentTaskId");
int returnedPriority = from(content).getInt("[0].priority");
String returnedProcessDefinitionId = from(content).getString("[0].processDefinitionId");
String returnedProcessInstanceId = from(content).getString("[0].processInstanceId");

代码示例来源:origin: camunda/camunda-bpm-platform

String returnedJobId = from(content).getString("[0].jobId");
String returnedJobDueDate = from(content).getString("[0].jobDueDate");
int returnedJobRetries = from(content).getInt("[0].jobRetries");
long returnedJobPriority = from(content).getLong("[0].jobPriority");
String returnedJobExceptionMessage = from(content).getString("[0].jobExceptionMessage");

代码示例来源:origin: camunda/camunda-bpm-platform

Long returnedDurationInMillis = from(content).getLong("[0].duration");
String returnedTaskDefinitionKey = from(content).getString("[0].taskDefinitionKey");
int returnedPriority = from(content).getInt("[0].priority");
String returnedParentTaskId = from(content).getString("[0].parentTaskId");
Date returnedDue = DateTimeUtil.parseDate(from(content).getString("[0].due"));

相关文章