Last active
May 25, 2024 10:20
-
-
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/4e54128f4a2413c18c7f8822f2b50ecaf0b1e395
This file contains 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.4.2" | |
//> using dep "fr.janalyse::drools-scripting:1.0.16" | |
//> using dep "org.scalatest::scalatest:3.2.10" | |
// --------------------- | |
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