-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect rule validation for non annotated fact parameters #165
Comments
The message of the exception you mentioned is about the condition method, but your example is about the action method. I'm not sure I understand your point. Can you please clarify? The best way is to provide a test with what you are expecting so I can understand the problem. Thank you upfront. |
Hi @khaledabderrahim , Thank you for opening this issue! After further analysis, this is indeed a bug in Easy Rules. It is more than the error message being incorrect (and confusing!), it is actually a rule validation issue. The example of rule you gave is invalid (parameter @Test(expected = IllegalArgumentException.class)
public void methodParametersShouldAllBeAnnotatedWithFactUnlessExactlyOneOfThemIsOfTypeFacts() {
@Rule
class MyRule {
@Action
public void myAction( @Fact("i") Integer i,Float f ) {
System.out.println("action method ");
}
@Condition
public boolean myCondition() {
return true;
}
@Priority
int myRulePriority() {
return 0;
}
}
new RuleDefinitionValidator().validateRuleDefinition(new MyRule());
}
The solution you suggest breaks several tests, so I fixed the issue differently (See df6e0f7). I also updated the error message to be more explicit. The fix has been deployed in version Kr, |
the message of the exception says :
but in the implementation 👎 just if there is no parameters annotated with
@Fact
then the only parameter must be subtype of
Facts
will print true
solution : change
to :
The text was updated successfully, but these errors were encountered: