Last active
February 3, 2026 20:18
-
-
Save dacr/3733f31509bd265eb103b62be5b3b8b7 to your computer and use it in GitHub Desktop.
Drools parsing issues / published by https://github.com/dacr/code-examples-manager #35be246f-26fd-4583-8da7-286d601cf37b/e535aaf900f6d08e1a5936aad5cde182b2771ae0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // summary : Drools parsing issues | |
| // keywords : scala, drools, mvel, scalatest, ai, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : 35be246f-26fd-4583-8da7-286d601cf37b | |
| // created-on : 2019-10-02T17:04:57+02:00 | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file | |
| // --------------------- | |
| //> using scala "3.5.1" | |
| //> using dep "fr.janalyse::drools-scripting:1.2.0" | |
| //> using dep "org.scalatest::scalatest:3.2.19" | |
| // --------------------- | |
| import fr.janalyse.droolscripting.*, org.scalatest.*, flatspec.*, matchers.*, OptionValues.* | |
| object DroolsParsingTest extends AnyFlatSpec with should.Matchers { | |
| info("Be aware of the fact that drools knowledge base parsing may just fail...") | |
| "Drools parser" should "(not) give NullPointerException on inheritance issue" in { | |
| val drl = | |
| """package test | |
| |declare Truc end | |
| |declare Muche extends truc end | |
| |""".stripMargin | |
| intercept[NullPointerException] { // still true with drools 7.54.0.FINAL | |
| val engine = DroolsEngine(drl) // because Muche extends truc instead of Truc | |
| engine.fireAllRules() | |
| } | |
| } | |
| } | |
| DroolsParsingTest.execute() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment