예제 #1
0
 /** @see {@link LogicService#getRule(String)} */
 @Test
 @Verifies(value = "should return ReferenceRule", method = "getRule(String)")
 public void getRule_shouldReturnReferenceRule() throws Exception {
   Rule rule = Context.getLogicService().getRule("%%person.birthdate");
   Assert.assertNotNull(rule);
   Assert.assertTrue(rule.getClass().isAssignableFrom(ReferenceRule.class));
 }
예제 #2
0
 /** @see {@link LogicService#getRule(String)} */
 @Test
 @Verifies(
     value = "should return Rule associated with the input token",
     method = "getRule(String)")
 public void getRule_shouldReturnRuleAssociatedWithTheInputToken() throws Exception {
   Rule ageRule = Context.getLogicService().getRule("AGE");
   Assert.assertNotNull(ageRule);
   Assert.assertTrue(AgeRule.class.isAssignableFrom(ageRule.getClass()));
 }
예제 #3
0
 /**
  * CompareTo method
  *
  * @param otherRule the other Rule to compare with
  */
 public int compareTo(Rule otherRule) {
   if (getClass() == otherRule.getClass()) {
     ConditionRule other = (ConditionRule) otherRule;
     if (!condition.equals(other.getCondition())) {
       return condition.compareTo(other.getCondition());
     } else {
       Pair<Integer, Integer> otherP = other.getMinMax();
       if (min != otherP.first) {
         return ((Integer) min).compareTo(otherP.first);
       } else if (max != otherP.second) {
         return ((Integer) max).compareTo(otherP.second);
       }
       return 0;
     }
   } else {
     return 1;
   }
 }