Search in sources :

Example 16 with SoftAssertions

use of org.assertj.core.api.SoftAssertions in project drools by kiegroup.

the class EventFactHandleDeserializationTest method testDisconnectedEventFactHandle.

@Test
public void testDisconnectedEventFactHandle() {
    // DROOLS-924
    final String drl = "declare String \n" + "  @role(event)\n" + "end\n";
    final KieSession ksession = new KieHelper().addContent(drl, ResourceType.DRL).build().newKieSession();
    final DefaultFactHandle helloHandle = (DefaultFactHandle) ksession.insert("hello");
    final DefaultFactHandle goodbyeHandle = (DefaultFactHandle) ksession.insert("goodbye");
    final SoftAssertions softly = new SoftAssertions();
    FactHandle key = DefaultFactHandle.createFromExternalFormat(helloHandle.toExternalForm());
    softly.assertThat(key).isInstanceOf(EventFactHandle.class);
    softly.assertThat(ksession.getObject(key)).isEqualTo("hello");
    key = DefaultFactHandle.createFromExternalFormat(goodbyeHandle.toExternalForm());
    softly.assertThat(key).isInstanceOf(EventFactHandle.class);
    softly.assertThat(ksession.getObject(key)).isEqualTo("goodbye");
    softly.assertAll();
}
Also used : DefaultFactHandle(org.drools.core.common.DefaultFactHandle) DefaultFactHandle(org.drools.core.common.DefaultFactHandle) EventFactHandle(org.drools.core.common.EventFactHandle) FactHandle(org.kie.api.runtime.rule.FactHandle) SoftAssertions(org.assertj.core.api.SoftAssertions) KieHelper(org.kie.internal.utils.KieHelper) KieSession(org.kie.api.runtime.KieSession) Test(org.junit.Test)

Aggregations

SoftAssertions (org.assertj.core.api.SoftAssertions)16 Test (org.junit.Test)15 FeedItem (gov.whitehouse.data.model.FeedItem)1 SimpleEntry (java.util.AbstractMap.SimpleEntry)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 GfJsonArray (org.apache.geode.management.internal.cli.json.GfJsonArray)1 GfJsonObject (org.apache.geode.management.internal.cli.json.GfJsonObject)1 TabularResultData (org.apache.geode.management.internal.cli.result.TabularResultData)1 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)1 DefaultFactHandle (org.drools.core.common.DefaultFactHandle)1 EventFactHandle (org.drools.core.common.EventFactHandle)1 KieSession (org.kie.api.runtime.KieSession)1 FactHandle (org.kie.api.runtime.rule.FactHandle)1 KieHelper (org.kie.internal.utils.KieHelper)1