MappingRuleCreator { public List<MappingRule> getMappingRules(String jsonPath) throws IOException { MappingRulesDescription desc = getMappingRulesFromJson(jsonPath); return getMappingRules(desc); }  MappingRulesDescription getMappingRulesFromJson(String jsonPath); List<MappingRule> getMappingRules(String jsonPath);  }
@Test public void testAllGroupMatcherFailsDueToMatchString() { rule.setType(Type.GROUP); expected.expect(IllegalArgumentException.class); expected.expectMessage("Cannot match '*' for groups"); ruleCreator.getMappingRules(description); }
@Test public void testSetDefaultRuleWithMissingQueue() { rule.setPolicy(Policy.SET_DEFAULT_QUEUE); expected.expect(IllegalArgumentException.class); expected.expectMessage("default queue is undefined"); ruleCreator.getMappingRules(description); }
@Test public void testCustomRuleWithMissingQueue() { rule.setPolicy(Policy.CUSTOM); expected.expect(IllegalArgumentException.class); expected.expectMessage("custom queue is undefined"); ruleCreator.getMappingRules(description); }
@Test public void testFallbackResultUnset() { rule.setFallbackResult(null); List<MappingRule> rules = ruleCreator.getMappingRules(description); MappingRule mpr = rules.get(0); assertEquals("Fallback result", MappingRuleResultType.SKIP, mpr.getFallback().getResult()); }
@Test public void testTypeUnset() { rule.setType(null); expected.expect(IllegalArgumentException.class); expected.expectMessage("Rule type is undefined"); ruleCreator.getMappingRules(description); }
@Test public void testMatchesUnset() { rule.setMatches(null); expected.expect(IllegalArgumentException.class); expected.expectMessage("Match string is undefined"); ruleCreator.getMappingRules(description); }
@Test public void testMatchesEmpty() { rule.setMatches(""); expected.expect(IllegalArgumentException.class); expected.expectMessage("Match string is empty"); ruleCreator.getMappingRules(description); }
@Test public void testPolicyUnset() { rule.setPolicy(null); expected.expect(IllegalArgumentException.class); expected.expectMessage("Rule policy is undefined"); ruleCreator.getMappingRules(description); }