InMemoryRuleService implements RuleService { @Override public RuleDao load(String id) throws NotFoundException { final RuleDao rule = store.get(id); if (rule == null) { throw new NotFoundException("No such rule with id " + id); } return rule; }  @Override RuleDao save(RuleDao rule); @Override RuleDao load(String id); @Override Collection<RuleDao> loadAll(); @Override void delete(String id); @Override Collection<RuleDao> loadNamed(Collection<String> ruleNames);  }
@Test public void notFoundException() { try { service.load("1"); fail("Should throw an exception"); } catch (NotFoundException e) { assertThat(e).hasMessage("No such rule with id 1"); } }