AmazonAppStoreRule implements IEnvironmentBasedRule { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final IEnvironment environment) { return environment.isAmazonAppStoreInstalled(); }  @Override boolean shouldAllowFeedbackPrompt(@NonNull final IEnvironment environment); @NonNull @Override String getDescription();  }
@Test public void testThatEnvironmentRuleIsNotSatisfiedIfAmazonAppStoreIsNotInstalledOnDevice() { when(environment.isAmazonAppStoreInstalled()).thenReturn(false); final boolean isEnvironmentRuleSatisfied = amazonAppStoreRule.shouldAllowFeedbackPrompt(environment); assertFalse("Environment based rule should not be satisfied", isEnvironmentRuleSatisfied); }
@Test public void testThatEnvironmentRuleIsSatisfiedIfAmazonAppStoreIsInstalledOnDevice() { when(environment.isAmazonAppStoreInstalled()).thenReturn(true); final boolean isEnvironmentRuleSatisfied = amazonAppStoreRule.shouldAllowFeedbackPrompt(environment); assertTrue("Environment based rule should be satisfied", isEnvironmentRuleSatisfied); }