Ok, I changed my drl file and main method as follows, and it works. Thank
you.
package MyPackage
import MyPackage.Applicant;
rule "Is of not valid age"
when$a : Applicant( age > 17 )
$a : Applicant( age < 18 )
then
$a.setValid ( false );
end
rule "Is of valid age"
when
then
$a.setValid ( true );
end
assertFalse( applicant.isValid() );
KieServices kieServices = KieServices.Factory.get();
KieContainer kContainer = kieServices.getKieClasspathContainer();
StatelessKieSession kSession = kContainer.newStatelessKieSession();
Applicant applicant = new Applicant("Mr John Smith", 16);
kSession.execute( applicant ) ;Applicant applicant2 = new Applicant("Mr Bill Wayne", 22);
assertFalse ( applicant.isValid() );
assertFalse( applicant2.isValid() );
kSession.execute( applicant2 ) ;
assertTrue ( applicant2.isValid() );
--
View this message in context: http://drools.46999.n3.nabble.com/Driving-License-application-tp4027403p4027407.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users