in ddm-bpm-client/src/it/java/com/epam/digital/data/platform/bpms/client/ProcessInstanceRestClientIT.java [140:170]
void getProcessInstances() {
var processInstanceQuery = DdmProcessInstanceQueryDto.builder()
.rootProcessInstances(true)
.build();
var paginationQueryDto = PaginationQueryDto.builder()
.firstResult(1).maxResults(2).build();
restClientWireMock.addStubMapping(
stubFor(post(urlPathEqualTo("/api/extended/process-instance"))
.withQueryParam("firstResult", equalTo("1"))
.withQueryParam("maxResults", equalTo("2"))
.withRequestBody(
equalToJson("{\"rootProcessInstances\":true,\"sortBy\":null,\"sortOrder\":null}"))
.willReturn(aResponse()
.withStatus(200)
.withBody("[{\"id\":\"id\",\"processDefinitionId\":\"processDefinitionId\","
+ "\"processDefinitionName\":\"processDefinitionName\","
+ "\"startTime\":\"2021-12-07T13:51:31.000Z\","
+ "\"state\":\"PENDING\"}]")))
);
var result = processInstanceRestClient.getProcessInstances(processInstanceQuery,
paginationQueryDto);
assertThat(result).hasSize(1)
.element(0).hasFieldOrPropertyWithValue("id", "id")
.hasFieldOrPropertyWithValue("processDefinitionId", "processDefinitionId")
.hasFieldOrPropertyWithValue("processDefinitionName", "processDefinitionName")
.hasFieldOrPropertyWithValue("startTime", LocalDateTime.of(2021, 12, 7, 13, 51, 31))
.hasFieldOrPropertyWithValue("state", DdmProcessInstanceStatus.PENDING);
}