This is an automated email from the ASF dual-hosted git repository.
mariofusco pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git
The following commit(s) were added to refs/heads/main by this push:
new 4b09ccaa06 Enhanced testSalienceIntegerAndLoadOrder for better memory
management and type safety (#6042)
4b09ccaa06 is described below
commit 4b09ccaa06b1c9bdb2666bf5ebdb5e776d87db67
Author: Rashmesh <[email protected]>
AuthorDate: Tue Aug 20 23:57:26 2024 -0700
Enhanced testSalienceIntegerAndLoadOrder for better memory management and
type safety (#6042)
Co-authored-by: Rashmesh Radhakrishnan
<[email protected]>
---
.../integrationtests/ExecutionFlowControlTest.java | 27 ++++++++++++++--------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git
a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/ExecutionFlowControlTest.java
b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/ExecutionFlowControlTest.java
index ebbd2d9f35..8c0b40dcb9 100644
---
a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/ExecutionFlowControlTest.java
+++
b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/ExecutionFlowControlTest.java
@@ -71,19 +71,26 @@ public class ExecutionFlowControlTest {
@Test(timeout = 10000)
public void testSalienceIntegerAndLoadOrder() throws Exception {
KieBase kbase =
KieBaseUtil.getKieBaseFromClasspathResources(this.getClass(),
kieBaseTestConfiguration, "test_salienceIntegerRule.drl");
- KieSession ksession = kbase.newKieSession();
- final List list = new ArrayList();
- ksession.setGlobal( "list", list );
+ KieSession ksession = null;
+ try {
+ ksession = kbase.newKieSession();
+ final List<String> list = new ArrayList<>();
+ ksession.setGlobal("list", list);
- final PersonInterface person = new Person( "Edson", "cheese" );
- ksession.insert( person );
+ final PersonInterface person = new Person("Edson", "cheese");
+ ksession.insert(person);
- ksession.fireAllRules();
+ ksession.fireAllRules();
- assertThat(list.size()).as("Three rules should have been
fired").isEqualTo(3);
- assertThat(list.get(0)).as("Rule 4 should have been fired
first").isEqualTo("Rule 4");
- assertThat(list.get(1)).as("Rule 2 should have been fired
second").isEqualTo("Rule 2");
- assertThat(list.get(2)).as("Rule 3 should have been fired
third").isEqualTo("Rule 3");
+ assertThat(list.size()).as("Three rules should have been
fired").isEqualTo(3);
+ assertThat(list.get(0)).as("Rule 4 should have been fired
first").isEqualTo("Rule 4");
+ assertThat(list.get(1)).as("Rule 2 should have been fired
second").isEqualTo("Rule 2");
+ assertThat(list.get(2)).as("Rule 3 should have been fired
third").isEqualTo("Rule 3");
+ } finally {
+ if (ksession != null) {
+ ksession.dispose();
+ }
+ }
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]