Search in sources :

Example 6 with JITDMNResult

use of org.kie.kogito.jitexecutor.dmn.responses.JITDMNResult in project kogito-apps by kiegroup.

the class MultipleModelsTest method testjitdmnResultEndpointCH11_withErrors.

@Test
public void testjitdmnResultEndpointCH11_withErrors() throws Exception {
    // will omit `Applicant data` intentionally.
    Map<String, Object> context = new HashMap<>();
    context.put("Bureau data", Map.of("Bankrupt", false, "CreditScore", 600));
    context.put("Requested product", Map.of("ProductType", "STANDARD LOAN", "Rate", 0.08d, "Term", 36, "Amount", 100_00));
    JITDMNPayload jitdmnpayload = new JITDMNPayload(CH11URI1, List.of(ch11model1, ch11model2), context);
    String response = given().contentType(ContentType.JSON).body(jitdmnpayload).when().post("/jitdmn/dmnresult").then().statusCode(200).body("dmnContext.'Required monthly installment'", notNullValue()).extract().asString();
    JITDMNResult result = MAPPER.readValue(response, JITDMNResult.class);
    assertThat(result.getMessages()).isNotEmpty().allMatch(m -> m.getPath().equals(CH11URI1));
}
Also used : JITDMNPayload(org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload) HashMap(java.util.HashMap) JITDMNResult(org.kie.kogito.jitexecutor.dmn.responses.JITDMNResult) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

JITDMNResult (org.kie.kogito.jitexecutor.dmn.responses.JITDMNResult)6 HashMap (java.util.HashMap)3 DMNResult (org.kie.dmn.api.core.DMNResult)3 Test (org.junit.jupiter.api.Test)2 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 Random (java.util.Random)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Produces (javax.ws.rs.Produces)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 LimeConfig (org.kie.kogito.explainability.local.lime.LimeConfig)1 LimeExplainer (org.kie.kogito.explainability.local.lime.LimeExplainer)1 PerturbationContext (org.kie.kogito.explainability.model.PerturbationContext)1 Prediction (org.kie.kogito.explainability.model.Prediction)1 Saliency (org.kie.kogito.explainability.model.Saliency)1 SimplePrediction (org.kie.kogito.explainability.model.SimplePrediction)1 JITDMNResourceTest (org.kie.kogito.jitexecutor.dmn.api.JITDMNResourceTest)1 JITDMNPayload (org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload)1