@SuppressWarnings("UnnecessaryLocalVariable") @Test public void testThatRuleBlocksPromptIfAppVersionCodeHasNotChanged() { final int fakeCachedVersionCode = 42; final int fakeCurrentVersionCode = fakeCachedVersionCode; final VersionCodeChangedRule versionCodeChangedRule = new VersionCodeChangedRule(fakeCurrentVersionCode); final boolean ruleShouldAllowFeedbackPrompt = versionCodeChangedRule.shouldAllowFeedbackPrompt(fakeCurrentVersionCode); assertFalse( "Feedback prompt should be blocked if the app version code has not changed", ruleShouldAllowFeedbackPrompt); }
@Override public boolean shouldAllowFeedbackPrompt(@NonNull final Integer cachedEventValue) { return cachedEventValue < appVersionCode; }
VersionCodeChangedRule implements IEventBasedRule<Integer> { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final Integer cachedEventValue) { return cachedEventValue < appVersionCode; } }
VersionCodeChangedRule implements IEventBasedRule<Integer> { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final Integer cachedEventValue) { return cachedEventValue < appVersionCode; } VersionCodeChangedRule(@NonNull final Context context); @VisibleForTesting(otherwise = PRIVATE)  VersionCodeChangedRule(final int appVersionCode); }
VersionCodeChangedRule implements IEventBasedRule<Integer> { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final Integer cachedEventValue) { return cachedEventValue < appVersionCode; } VersionCodeChangedRule(@NonNull final Context context); @VisibleForTesting(otherwise = PRIVATE)  VersionCodeChangedRule(final int appVersionCode); @Override boolean shouldAllowFeedbackPromptByDefault(); @Override boolean shouldAllowFeedbackPrompt(@NonNull final Integer cachedEventValue); @NonNull @Override String getDescription(); }
VersionCodeChangedRule implements IEventBasedRule<Integer> { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final Integer cachedEventValue) { return cachedEventValue < appVersionCode; } VersionCodeChangedRule(@NonNull final Context context); @VisibleForTesting(otherwise = PRIVATE)  VersionCodeChangedRule(final int appVersionCode); @Override boolean shouldAllowFeedbackPromptByDefault(); @Override boolean shouldAllowFeedbackPrompt(@NonNull final Integer cachedEventValue); @NonNull @Override String getDescription();  }