CacheConfig extends Config { @Override protected void validate() { if (caches.isEmpty()) { throw new Error("cache is configured but no cache added, please remove unnecessary config"); } if (maxLocalSize > 0 && localCacheStore != null) { localCacheStore.maxSize = maxLocalSize; } }  void local(); void redis(String host); CacheStoreConfig add(Class<T> cacheClass, Duration duration); void maxLocalSize(int size);  }
@Test void validate() { assertThatThrownBy(() -> config.validate()) .hasMessageContaining("cache is configured but no cache added"); }