@Test public void testThatPresenterThrowsCorrectExceptionIfUserFeedbackActionIsSuppliedBeforeUserOpinion() { final IPromptPresenter.UserFeedbackAction anyValidUserFeedbackAction = IPromptPresenter.UserFeedbackAction.AGREED; exception.expect(IllegalStateException.class); exception.expectMessage("User opinion must be set before this method is called."); promptPresenter.reportUserFeedbackAction(anyValidUserFeedbackAction); }
@Override public void reportUserFeedbackAction(@NonNull final UserFeedbackAction userFeedbackAction) { if (promptFlowState != PromptFlowState.REQUESTING_POSITIVE_FEEDBACK && promptFlowState != PromptFlowState.REQUESTING_CRITICAL_FEEDBACK) { throw new IllegalStateException( "User opinion must be set before this method is called."); } if (userFeedbackAction == UserFeedbackAction.AGREED) { handleUserAgreedToGiveFeedback(); } else if (userFeedbackAction == UserFeedbackAction.DECLINED) { handleUserDeclinedToGiveFeedback(); } }
PromptPresenter implements IPromptPresenter { @Override public void reportUserFeedbackAction(@NonNull final UserFeedbackAction userFeedbackAction) { if (promptFlowState != PromptFlowState.REQUESTING_POSITIVE_FEEDBACK && promptFlowState != PromptFlowState.REQUESTING_CRITICAL_FEEDBACK) { throw new IllegalStateException( "User opinion must be set before this method is called."); } if (userFeedbackAction == UserFeedbackAction.AGREED) { handleUserAgreedToGiveFeedback(); } else if (userFeedbackAction == UserFeedbackAction.DECLINED) { handleUserDeclinedToGiveFeedback(); } } }
PromptPresenter implements IPromptPresenter { @Override public void reportUserFeedbackAction(@NonNull final UserFeedbackAction userFeedbackAction) { if (promptFlowState != PromptFlowState.REQUESTING_POSITIVE_FEEDBACK && promptFlowState != PromptFlowState.REQUESTING_CRITICAL_FEEDBACK) { throw new IllegalStateException( "User opinion must be set before this method is called."); } if (userFeedbackAction == UserFeedbackAction.AGREED) { handleUserAgreedToGiveFeedback(); } else if (userFeedbackAction == UserFeedbackAction.DECLINED) { handleUserDeclinedToGiveFeedback(); } } PromptPresenter(
            @NonNull final IEventListener eventListener,
            @NonNull final IPromptView promptView); }
PromptPresenter implements IPromptPresenter { @Override public void reportUserFeedbackAction(@NonNull final UserFeedbackAction userFeedbackAction) { if (promptFlowState != PromptFlowState.REQUESTING_POSITIVE_FEEDBACK && promptFlowState != PromptFlowState.REQUESTING_CRITICAL_FEEDBACK) { throw new IllegalStateException( "User opinion must be set before this method is called."); } if (userFeedbackAction == UserFeedbackAction.AGREED) { handleUserAgreedToGiveFeedback(); } else if (userFeedbackAction == UserFeedbackAction.DECLINED) { handleUserDeclinedToGiveFeedback(); } } PromptPresenter(
            @NonNull final IEventListener eventListener,
            @NonNull final IPromptView promptView); @Override void notifyEventTriggered(@NonNull final IEvent event); @Override void addPromptEventListener(@NonNull final IEventListener promptEventListener); @Override void start(); @Override void reportUserOpinion(@NonNull final UserOpinion userOpinion); @Override void reportUserFeedbackAction(@NonNull final UserFeedbackAction userFeedbackAction); @Override void restoreStateFromBundle(@NonNull final Bundle bundle); @NonNull @Override Bundle generateStateBundle(); }
PromptPresenter implements IPromptPresenter { @Override public void reportUserFeedbackAction(@NonNull final UserFeedbackAction userFeedbackAction) { if (promptFlowState != PromptFlowState.REQUESTING_POSITIVE_FEEDBACK && promptFlowState != PromptFlowState.REQUESTING_CRITICAL_FEEDBACK) { throw new IllegalStateException( "User opinion must be set before this method is called."); } if (userFeedbackAction == UserFeedbackAction.AGREED) { handleUserAgreedToGiveFeedback(); } else if (userFeedbackAction == UserFeedbackAction.DECLINED) { handleUserDeclinedToGiveFeedback(); } } PromptPresenter(
            @NonNull final IEventListener eventListener,
            @NonNull final IPromptView promptView); @Override void notifyEventTriggered(@NonNull final IEvent event); @Override void addPromptEventListener(@NonNull final IEventListener promptEventListener); @Override void start(); @Override void reportUserOpinion(@NonNull final UserOpinion userOpinion); @Override void reportUserFeedbackAction(@NonNull final UserFeedbackAction userFeedbackAction); @Override void restoreStateFromBundle(@NonNull final Bundle bundle); @NonNull @Override Bundle generateStateBundle();  }