Category { public List<MatchRule> getMatchRules() { return MoreObjects.firstNonNull(matchRules, ImmutableList.<MatchRule> of()); } Category(String name);  Category(String name, List<MatchRule> matchRules); String getName(); List<MatchRule> getMatchRules(); boolean matches(Transaction transaction); Category withMatchRule(MatchRule rule); @Override String toString();  }
@Test public void createWithMatchRules() { List<MatchRule> rules = ImmutableList.of(MatchRule.withPattern("abc"), MatchRule.withPattern("def")); Category category = new Category("a name", rules); assertEquals(rules, category.getMatchRules()); }