Skip to content

Instantly share code, notes, and snippets.

@dacr dacr/drools-hello-world.sc
Last active Oct 12, 2019

Embed
What would you like to do?
Drools Hello world #da1c86ab-08d9-4b33-806a-85326acbc9b6/dd181424e32a38118ea7f67403c6d95dba4ad45a
// summary : Drools Hello world
// keywords : scala, drools, mvel, scalatest, ai, @testable
// publish : gist, snippet
// authors : David Crosson
// id : da1c86ab-08d9-4b33-806a-85326acbc9b6
// execution : scala ammonite script (http://ammonite.io/) - run as follow 'amm scriptname.sc'
import $ivy.`fr.janalyse::drools-scripting:1.0.6`, $ivy.`org.scalatest::scalatest:3.0.8`
import fr.janalyse.droolscripting._, org.scalatest._, org.scalatest.OptionValues._
object HelloTest extends FlatSpec with Matchers {
"Drools" should "say hello" in {
val drl =
"""package test
|rule "hello" when
|then
| insert("HELLO WORLD");
|end
|""".stripMargin
val engine = DroolsEngine(drl)
engine.fireAllRules()
engine.strings shouldBe List("HELLO WORLD")
}
}
HelloTest.execute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.