AbstractRuleBucket { public T getById(String id) throws RuleException { T rule = rules.get(id); if (null == rule) { throw new RuleException("Cannot find " + getRuleTypeName() + " " + id); } return rule; }  int size(); Collection<T> getAll(); Set<String> getIds(); T getById(String id); List<T> match(String pattern); void add(B bucket);  }
@Test public void getConceptThrowsExceptionIfConceptNotFoundInBucket() { assertThatThrownBy(() -> bucket.getById("foobar")).isInstanceOf(RuleException.class); }