Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Drools parsing issues / published by https://github.com/dacr/code-examples-manager #35be246f-26fd-4583-8da7-286d601cf37b/91417bddd9ce5e134d8eebb29df2a93717048e98
// summary : Drools parsing issues
// keywords : scala, drools, mvel, scalatest, ai, @testable
// publish : gist
// authors : David Crosson
// license : Apache2
// id : 35be246f-26fd-4583-8da7-286d601cf37b
// execution : scala ammonite script (http://ammonite.io/) - run as follow 'amm scriptname.sc'
// created-on : 2019-10-02T17:04:57+02:00
import $ivy.`fr.janalyse::drools-scripting:1.0.11`, $ivy.`org.scalatest::scalatest:3.2.6`
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.27.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