TogglzEndpoint extends AbstractEndpoint<List<TogglzFeature>> { @Override public List<TogglzFeature> invoke() { List<TogglzFeature> features = new ArrayList<>(); for (Feature feature : this.featureManager.getFeatures()) { FeatureState featureState = this.featureManager.getFeatureState(feature); features.add(new TogglzFeature(feature, featureState)); } Collections.sort(features); return features; } TogglzEndpoint(FeatureManager featureManager); @Override List<TogglzFeature> invoke();  }
@Test public void invoke() throws Exception { load(new Class[]{TogglzAutoConfiguration.class, TogglzEndpointAutoConfiguration.class}, "togglz.features.FEATURE_ONE.enabled: true", "togglz.features.FEATURE_TWO.enabled: false", "togglz.features.FEATURE_TWO.strategy: release-date", "togglz.features.FEATURE_TWO.param.date: 2016-07-01", "togglz.features.FEATURE_TWO.param.time: 08:30:00"); TogglzEndpoint endpoint = this.context.getBean(TogglzEndpoint.class); List<TogglzFeature> features = endpoint.invoke(); assertEquals(2, features.size()); assertEquals("FEATURE_ONE", features.get(0).getName()); assertTrue(features.get(0).isEnabled()); assertNull(features.get(0).getStrategy()); assertEquals(0, features.get(0).getParams().size()); assertEquals("FEATURE_TWO", features.get(1).getName()); assertFalse(features.get(1).isEnabled()); assertEquals("release-date", features.get(1).getStrategy()); assertEquals(2, features.get(1).getParams().size()); assertEquals("2016-07-01", features.get(1).getParams().get("date")); assertEquals("08:30:00", features.get(1).getParams().get("time")); }