@Override
    public RuleDao loadByName(String name) throws NotFoundException {
        final String id = titleToId.get(name);
        if (id == null) {
            throw new NotFoundException("No rule with name " + name);
        }
        return load(id);
    }
@Test
    public void loadByNameNotFound() {
        assertThatThrownBy(() -> service.loadByName("Foobar"))
                .isInstanceOf(NotFoundException.class)
                .hasMessage("No rule with name Foobar");
    }