ClientExperimentalFeaturesRegistryServiceImpl implements ClientExperimentalFeaturesRegistryService { public void onGlobalFeatureModified(@Observes PortableExperimentalFeatureModifiedEvent event) { updateExperimentalFeature(event.getFeature().getFeatureId(), event.getFeature().isEnabled()); } @Inject  ClientExperimentalFeaturesRegistryServiceImpl(Caller<BackendExperimentalFeaturesRegistryService> backendService, Event<NonPortableExperimentalFeatureModifiedEvent> event); @Override void loadRegistry(); @Override ExperimentalFeaturesRegistry getFeaturesRegistry(); @Override boolean isFeatureEnabled(String featureId); @Override void updateExperimentalFeature(String featureId, boolean enabled); @Override Boolean isExperimentalEnabled(); void onGlobalFeatureModified(@Observes PortableExperimentalFeatureModifiedEvent event);  }
@Test public void testNotifyFeatureUpdateViaEvent() { initService(true); ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false); service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature)); checkNotifyFeatureUpdate(feature); }
@Test public void testWrongNotifyFeatureUpdateViaEvent() { initService(true); ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, true); service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature)); verify(event, never()).fire(any()); feature = new ExperimentalFeatureImpl(WRONG_FEATURE_ID, true); service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature)); verify(event, never()).fire(any()); }
@Test public void testNotifyFeatureUpdateWhenExperimentalDisabledViaEvent() { initService(false); ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false); service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature)); verify(event, never()).fire(any()); }