FeatureChecker { public T run() { T result = null; if(context.hasFeature(featureName)) { result = onFeatureEnabled(); } else { result = onFeatureDisabled(); } return result; } FeatureChecker(FeatureContext storage, String featureName); abstract T onFeatureEnabled(); abstract T onFeatureDisabled(); T run();  }
@Test public void run_WithFeature_ReturnEnabled(){ when(context.hasFeature("test.feature")).thenReturn(true); assertEquals("checker should return 'enabledStatus' string", "enabledStatus", checker.run()); }
@Test public void run_WithoutFeature_ReturnDisabled() { when(context.hasFeature("test.feature")).thenReturn(false); assertEquals("checker should return 'disabledStatus' string", "disabledStatus", checker.run()); }