FeatureStoreReal implements FeatureStore { void open() { loadFeaturesIntoCache(); } FeatureStoreReal(FeatureClient client, FeatureStoreLocal backingFeatureStore); @Override Void put(Feature feature); @Override FeatureRecord find(String group, String featureKey); @Override FeatureCollection findAll(String group); @Override Void remove(String group, String featureKey); @Override Void removeAll(); @Override void close();  }
@Test public void noApiServerAndFailingLocalStoreDoesNotCrashTheFeatureLoader() { ServerConfiguration serverConfiguration = new ServerConfiguration() .baseURI("http: .defaultGroup("the_group"); final FeatureClient client = FeatureClient.newBuilder() .featureStore(new FeatureStoreFailing()) .localFeatureStore(new FeatureStoreLocalNone()) .serverConfiguration(serverConfiguration) .build(); FeatureStoreLocal failing = new FeatureStoreLocalFailing(); FeatureStoreReal fs = new FeatureStoreReal(client, failing); try { fs.open(); assertTrue("should call api server for single group", fs.loadFromApiAttempted.get()); assertFalse("should call api server for single group when api server down", fs.loadFromApiSuccessful.get()); assertTrue( "should call local store for single group", fs.loadFromLocalAttempted.get()); assertFalse("should not load local store for single group when local store crashes", fs.loadFromLocalSuccessful.get()); } catch (Exception e) { e.printStackTrace(); fail(); } }