Search in sources :

Example 1 with MockDecisionResultBuilder

use of org.camunda.bpm.engine.rest.helper.MockDecisionResultBuilder in project camunda-bpm-platform by camunda.

the class DecisionDefinitionRestServiceInteractionTest method testEvaluateDecisionMultipleDecisionValues.

@Test
public void testEvaluateDecisionMultipleDecisionValues() {
    DmnDecisionResult decisionResult = new MockDecisionResultBuilder().resultEntries().entry("status", Variables.stringValue("gold")).entry("assignee", Variables.stringValue("manager")).build();
    when(decisionEvaluationBuilderMock.evaluate()).thenReturn(decisionResult);
    Map<String, Object> json = new HashMap<String, Object>();
    json.put("variables", Collections.emptyMap());
    given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.OK.getStatusCode()).body("size()", is(1)).body("[0].size()", is(2)).body("[0].status.value", is("gold")).body("[0].assignee.value", is("manager")).when().post(EVALUATE_DECISION_URL);
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) MockDecisionResultBuilder(org.camunda.bpm.engine.rest.helper.MockDecisionResultBuilder) HashMap(java.util.HashMap) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 2 with MockDecisionResultBuilder

use of org.camunda.bpm.engine.rest.helper.MockDecisionResultBuilder in project camunda-bpm-platform by camunda.

the class DecisionDefinitionRestServiceInteractionTest method testEvaluateDecisionMultipleDecisionOutputs.

@Test
public void testEvaluateDecisionMultipleDecisionOutputs() {
    DmnDecisionResult decisionResult = new MockDecisionResultBuilder().resultEntries().entry("status", Variables.stringValue("gold")).resultEntries().entry("assignee", Variables.stringValue("manager")).build();
    when(decisionEvaluationBuilderMock.evaluate()).thenReturn(decisionResult);
    Map<String, Object> json = new HashMap<String, Object>();
    json.put("variables", Collections.emptyMap());
    given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.OK.getStatusCode()).body("size()", is(2)).body("[0].size()", is(1)).body("[0].status.value", is("gold")).body("[1].size()", is(1)).body("[1].assignee.value", is("manager")).when().post(EVALUATE_DECISION_URL);
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) MockDecisionResultBuilder(org.camunda.bpm.engine.rest.helper.MockDecisionResultBuilder) HashMap(java.util.HashMap) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 3 with MockDecisionResultBuilder

use of org.camunda.bpm.engine.rest.helper.MockDecisionResultBuilder in project camunda-bpm-platform by camunda.

the class DecisionDefinitionRestServiceInteractionTest method testEvaluateDecisionSingleDecisionOutput.

@Test
public void testEvaluateDecisionSingleDecisionOutput() {
    DmnDecisionResult decisionResult = new MockDecisionResultBuilder().resultEntries().entry("status", Variables.stringValue("gold")).build();
    when(decisionEvaluationBuilderMock.evaluate()).thenReturn(decisionResult);
    Map<String, Object> json = new HashMap<String, Object>();
    json.put("variables", Collections.emptyMap());
    given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.OK.getStatusCode()).body("size()", is(1)).body("[0].size()", is(1)).body("[0].status", is(notNullValue())).body("[0].status.value", is("gold")).when().post(EVALUATE_DECISION_URL);
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) MockDecisionResultBuilder(org.camunda.bpm.engine.rest.helper.MockDecisionResultBuilder) HashMap(java.util.HashMap) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)3 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)3 MockDecisionResultBuilder (org.camunda.bpm.engine.rest.helper.MockDecisionResultBuilder)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Test (org.junit.Test)3 Matchers.anyString (org.mockito.Matchers.anyString)3