@Test public void testBeginOptionalRule() throws LicenseTemplateRuleException { String ruleName = "optionalName"; String ruleStr = "beginOptional;name=" + ruleName; LicenseTemplateRule rule = new LicenseTemplateRule(ruleStr); assertEquals(RuleType.BEGIN_OPTIONAL, rule.getType()); assertEquals(ruleName, rule.getName()); }
@Test public void testparseLicenseTemplateRule() throws LicenseTemplateRuleException { LicenseTemplateRule rule = new LicenseTemplateRule("Name", RuleType.BEGIN_OPTIONAL, "original", "match", "example"); rule.parseLicenseTemplateRule(PARSEABLE_RULE); assertEquals(rule.getExample(), RULE_EXAMPLE); assertEquals(rule.getName(), RULE_NAME); assertEquals(rule.getOriginal(), RULE_ORIGINAL); assertEquals(rule.getType(), RULE_TYPE); assertEquals(rule.getMatch(), RULE_MATCH); }
@Test public void testEndOptionalRule() throws LicenseTemplateRuleException { String ruleStr = "endOptional"; LicenseTemplateRule rule = new LicenseTemplateRule(ruleStr); assertEquals(RuleType.END_OPTIONAL, rule.getType()); }