CacheConfig extends Config { public void local() { if (localCacheStore != null || redisCacheStore != null) throw new Error("cache store is already configured, please configure only once"); localCacheStore(); }  void local(); void redis(String host); CacheStoreConfig add(Class<T> cacheClass, Duration duration); void maxLocalSize(int size);  }
@Test void local() { config.local(); assertThatThrownBy(() -> config.local()) .hasMessageContaining("cache store is already configured"); assertThatThrownBy(() -> config.redis("localhost")) .hasMessageContaining("cache store is already configured"); }