GooglePlayStoreRule implements IEnvironmentBasedRule { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final IEnvironment environment) { return environment.isGooglePlayStoreInstalled(); }  @Override boolean shouldAllowFeedbackPrompt(@NonNull final IEnvironment environment); @NonNull @Override String getDescription();  }
@Test public void testThatEnvironmentRuleIsSatisfiedIfGooglePlayStoreIsInstalledOnDevice() { when(environment.isGooglePlayStoreInstalled()).thenReturn(true); final boolean isEnvironmentRuleSatisfied = googlePlayStoreRule.shouldAllowFeedbackPrompt(environment); assertTrue("Environment based rule should be satisfied", isEnvironmentRuleSatisfied); }
@Test public void testThatEnvironmentRuleIsNotSatisfiedIfGooglePlayStoreIsNotInstalledOnDevice() { when(environment.isGooglePlayStoreInstalled()).thenReturn(false); final boolean isEnvironmentRuleSatisfied = googlePlayStoreRule.shouldAllowFeedbackPrompt(environment); assertFalse("Environment based rule should not be satisfied", isEnvironmentRuleSatisfied); }