CacheController { CacheImpl<?> cache(String name) { CacheImpl<?> cache = caches.get(name); if (cache == null) throw new NotFoundException("cache not found, name=" + name); return cache; } CacheController(Map<String, CacheImpl<?>> caches); Response get(Request request); Response delete(Request request); Response list(Request request);  }
@Test void cache() { assertThatThrownBy(() -> controller.cache("notExistingCache")) .isInstanceOf(NotFoundException.class); }