Last active
October 6, 2024 10:54
-
-
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/b6532cb1c5c4d5b69313b07ef93113b23b31b26e
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 NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// 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