@Test public void ruleBookFactoryBeanShouldBeCreatedEvenIfBothClassAndPackageAreNull() throws Exception { RuleBookFactoryBean factoryBean = new RuleBookFactoryBean(null, null); RuleBook<String> ruleBook = (RuleBook<String>)factoryBean.getObject(); ruleBook.addRule(RuleBuilder.create().withFactType(String.class) .given(_facts) .when(facts -> facts.getValue("value1").equals("Value")) .then(facts -> facts.setValue("value1", "Value One")) .build()); ruleBook.run(_facts); Assert.assertEquals("Value One", _facts.getValue("value1")); }
@Override public RuleBook getObject() throws Exception { if (_package != null) { if (_ruleBookType != null) { return new RuleBookRunner(_ruleBookType, _package); } return new RuleBookRunner(_package); } if (_ruleBookType != null) { return RuleBookBuilder.create(_ruleBookType).build(); } return new CoRRuleBook(); }
RuleBookFactoryBean implements FactoryBean<RuleBook> { @Override public RuleBook getObject() throws Exception { if (_package != null) { if (_ruleBookType != null) { return new RuleBookRunner(_ruleBookType, _package); } return new RuleBookRunner(_package); } if (_ruleBookType != null) { return RuleBookBuilder.create(_ruleBookType).build(); } return new CoRRuleBook(); } }
RuleBookFactoryBean implements FactoryBean<RuleBook> { @Override public RuleBook getObject() throws Exception { if (_package != null) { if (_ruleBookType != null) { return new RuleBookRunner(_ruleBookType, _package); } return new RuleBookRunner(_package); } if (_ruleBookType != null) { return RuleBookBuilder.create(_ruleBookType).build(); } return new CoRRuleBook(); } @Deprecated  RuleBookFactoryBean(Class<? extends RuleBook> ruleBookType, String pkg);  RuleBookFactoryBean(Class<? extends RuleBook> ruleBookType); @Deprecated  RuleBookFactoryBean(String pkg); }
RuleBookFactoryBean implements FactoryBean<RuleBook> { @Override public RuleBook getObject() throws Exception { if (_package != null) { if (_ruleBookType != null) { return new RuleBookRunner(_ruleBookType, _package); } return new RuleBookRunner(_package); } if (_ruleBookType != null) { return RuleBookBuilder.create(_ruleBookType).build(); } return new CoRRuleBook(); } @Deprecated  RuleBookFactoryBean(Class<? extends RuleBook> ruleBookType, String pkg);  RuleBookFactoryBean(Class<? extends RuleBook> ruleBookType); @Deprecated  RuleBookFactoryBean(String pkg); @Override RuleBook getObject(); @Override Class<?> getObjectType(); @Override boolean isSingleton(); }
RuleBookFactoryBean implements FactoryBean<RuleBook> { @Override public RuleBook getObject() throws Exception { if (_package != null) { if (_ruleBookType != null) { return new RuleBookRunner(_ruleBookType, _package); } return new RuleBookRunner(_package); } if (_ruleBookType != null) { return RuleBookBuilder.create(_ruleBookType).build(); } return new CoRRuleBook(); } @Deprecated  RuleBookFactoryBean(Class<? extends RuleBook> ruleBookType, String pkg);  RuleBookFactoryBean(Class<? extends RuleBook> ruleBookType); @Deprecated  RuleBookFactoryBean(String pkg); @Override RuleBook getObject(); @Override Class<?> getObjectType(); @Override boolean isSingleton();  }