@@ -0,0 +1,2004 @@
+package org.drools.decisiontable.parser;%0D%0A%0D%0Aimport java.util.HashMap;%0D%0Aimport java.util.Map;%0D%0A%0D%0Aimport junit.framework.TestCase;%0D%0A%0D%0Aimport org.drools.rule.GroupElement;%0D%0Aimport org.drools.rule.LiteralConstraint;%0D%0Aimport org.drools.rule.Package;%0D%0Aimport org.drools.rule.Rule;%0D%0A%0D%0Apublic class DefaultTemplateRuleBaseTest extends TestCase %7B%0D%0A%0D%0A%09public void testSimpleTemplate() throws Exception%0D%0A%09%7B%0D%0A%09%09TemplateContainer tc = new TemplateContainer() %7B%0D%0A%0D%0A%09%09%09public Column%5B%5D getColumns() %7B%0D%0A%09%09%09%09return new Column%5B%5D %7B%0D%0A%09%09%09%09%09%09new Column(%22column1%22),%0D%0A%09%09%09%09%09%09new Column(%22column2%22)%0D%0A%09%09%09%09%7D;%0D%0A%09%09%09%7D%0D%0A%0D%0A%09%09%09public String getHeader() %7B%0D%0A%09%09%09%09return null;%0D%0A%09%09%09%7D%0D%0A%0D%0A%09%09%09public Map getTemplates() %7B%0D%0A%09%09%09%09Map templates = new HashMap();%0D%0A%09%09%09%09RuleTemplate ruleTemplate = new RuleTemplate(%22template1%22);%0D%0A%09%09%09%09ruleTemplate.addColumn(%22column1%22);%0D%0A%09%09%09%09ruleTemplate.addColumn(%22column2%22);%0D%0A%09%09%09%09templates.put(%22template1%22, ruleTemplate);%0D%0A%09%09%09%09return templates;%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%7D;%0D%0A%09%09DefaultTemplateRuleBase ruleBase = new DefaultTemplateRuleBase(tc);%0D%0A%09%09Package%5B%5D packages = ruleBase.newWorkingMemory().getRuleBase().getPackages();%0D%0A%09%09assertEquals(1, packages.length);%0D%0A%09%09Map globals = packages%5B0%5D.getGlobals();%0D%0A%09%09assertEquals(DefaultGenerator.class, globals.get(%22generator%22));%0D%0A%09%09Rule%5B%5D rules = packages%5B0%5D.getRules();%0D%0A%09%09assertEquals(1, rules.length);%0D%0A%09%09assertEquals(%22template1%22, rules%5B0%5D.getName());%0D%0A%09%09GroupElement lhs = rules%5B0%5D.getLhs();%0D%0A%09%09//when%0D%0A%09%09//  r : Row()%0D%0A%09%09//  Cell(row == r, column == %22column1%22)%0D%0A%09%09//  Cell(row == r, column == %22column2%22)%0D%0A%09%09assertEquals(3, lhs.getChildren().size());%0D%0A%09%09org.drools.rule.Column column = (org.drools.rule.Column) lhs.getChildren().get(1);%0D%0A%09%09LiteralConstraint constraint = (LiteralConstraint) column.getConstraints().get(1);%0D%0A%09%09assertEquals(%22column1%22, constraint.getField().getValue());%0D%0A%09%09column = (org.drools.rule.Column) lhs.getChildren().get(2);%0D%0A%09%09constraint = (LiteralConstraint) column.getConstraints().get(1);%0D%0A%09%09assertEquals(%22column2%22, constraint.getField().getValue());%0D%0A%09%7D%0D%0A%7D%0D%0A

add extra tests