[rules-users] Help with my understanding

John.Dubchak at wellsfargo.com John.Dubchak at wellsfargo.com
Wed Dec 19 14:22:48 EST 2007


Yes, thanks for the reply.  I managed to correct the issue - my test
suite was picking up an older test file on my classpath.  (Yep, user
error)

John

-----Original Message-----
From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Andrew
Robinson
Sent: Wednesday, December 19, 2007 11:20 AM
To: Rules Users List
Subject: Re: [rules-users] Help with my understanding

although it looks like you may want "not matches" instead?

On Dec 19, 2007 10:19 AM, Andrew Robinson <andrew.rw.robinson at gmail.com>
wrote:
> How about this:
>
> rule "Valid Format"
> when
>   $status : RuleResult()
>   Identifier(value matches "^([0-9]{9})$")
> then
>   $status.addErrorMessage("Identifier does not match required
format");
> end
>
>
http://downloads.jboss.com/drools/docs/4.0.3.15993.GA/html_single/index.
html#d0e3318
>
>
> On Dec 19, 2007 9:48 AM,  <John.Dubchak at wellsfargo.com> wrote:
> >
> >
> >
> >
> > Hi,
> >
> >
> >
> > We are using Jboss-rules 3.0.5 and I have written a simple rule:
> >
> >
> >
> > rule "Valid Format"
> >
> >
> >
> >        when
> >
> >               $status : RuleResult()
> >
> >               $id : Identifier()
> >
> >
> >
> >               eval ($id.getValue() != null)
> >
> >               eval (!$id.getValue().matches("^([0-9]{9})$"))
> >
> >        then
> >
> >               $status.addErrorMessage("Identifier does not match
required
> > format");
> >
> >
> >
> > end
> >
> >
> >
> > In my unit test, I create an instance of the Identifier object and
do not
> > set the Value, therefore it is null by default.  I have an earlier
rule that
> > checks for this null value and places an error message in the result
object
> > appropriately.  I would expect this error to fail and not see this
error
> > message in the result, but instead see the missing value error
message.  The
> > problem is that I see both.
> >
> >
> >
> > It appears as though the eval null check is failing.  Am I
misunderstanding
> > how this rule should work?
> >
> >
> >
> > Any insight and/or answers are really appreciated.
> >
> >
> >
> > Thanks,
> >  John
> >
> >
> >
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users






More information about the rules-users mailing list