InAppAutomation extends AirshipComponent implements InAppAutomationScheduler { public boolean isPaused() { return getDataStore().getBoolean(PAUSE_KEY, false); } @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)  InAppAutomation(@NonNull Context context,
                           @NonNull PreferenceDataStore preferenceDataStore,
                           @NonNull AirshipRuntimeConfig runtimeConfig,
                           @NonNull Analytics analytics,
                           @NonNull RemoteData remoteData,
                           @NonNull AirshipChannel airshipChannel,
                           @NonNull NamedUser namedUser); @VisibleForTesting  InAppAutomation(@NonNull Context context,
                    @NonNull PreferenceDataStore preferenceDataStore,
                    @NonNull AutomationEngine engine,
                    @NonNull AirshipChannel airshipChannel,
                    @NonNull AudienceManager audienceManager,
                    @NonNull InAppRemoteDataObserver observer,
                    @NonNull InAppMessageManager inAppMessageManager,
                    @NonNull RetryingExecutor retryingExecutor,
                    @NonNull ActionRunRequestFactory actionRunRequestFactory,
                    @NonNull DeferredScheduleClient deferredScheduleClient); @NonNull static InAppAutomation shared(); @Override @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @AirshipComponentGroups.Group int getComponentGroup(); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @Override void onAirshipReady(@NonNull UAirship airship); @Override void onNewConfig(@Nullable JsonMap configValue); InAppMessageManager getInAppMessageManager(); @NonNull @Override PendingResult<Boolean> schedule(@NonNull List<Schedule<? extends ScheduleData>> schedules); @NonNull @Override PendingResult<Boolean> schedule(@NonNull Schedule<? extends ScheduleData> schedule); @NonNull PendingResult<Boolean> cancelSchedule(@NonNull String scheduleId); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) PendingResult<Boolean> cancelSchedules(@NonNull @Schedule.Type String type); @NonNull PendingResult<Boolean> cancelScheduleGroup(@NonNull String group); @NonNull @Override PendingResult<Collection<Schedule<Actions>>> getActionScheduleGroup(@NonNull final String group); @NonNull @Override PendingResult<Schedule<Actions>> getActionSchedule(@NonNull String scheduleId); @NonNull @Override PendingResult<Collection<Schedule<Actions>>> getActionSchedules(); @NonNull @Override PendingResult<Collection<Schedule<InAppMessage>>> getMessageScheduleGroup(@NonNull String group); @NonNull @Override PendingResult<Schedule<InAppMessage>> getMessageSchedule(@NonNull String scheduleId); @NonNull @Override PendingResult<Collection<Schedule<InAppMessage>>> getMessageSchedules(); @NonNull @Override @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) PendingResult<Collection<Schedule<? extends ScheduleData>>> getSchedules(); @NonNull @Override PendingResult<Boolean> editSchedule(@NonNull String scheduleId, @NonNull ScheduleEdits<? extends ScheduleData> edits); void setPaused(boolean paused); boolean isPaused(); void setEnabled(boolean enabled); boolean isEnabled();  }
@Test public void testIsPaused() { Schedule<Actions> schedule = Schedule.newBuilder(new Actions(JsonMap.EMPTY_MAP)) .addTrigger(Triggers.newAppInitTriggerBuilder().setGoal(1).build()) .build(); when(mockObserver.isRemoteSchedule(schedule)).thenReturn(false); when(mockObserver.isScheduleValid(schedule)).thenReturn(false); inAppAutomation.setPaused(true); assertEquals(AutomationDriver.READY_RESULT_NOT_READY, driver.onCheckExecutionReadiness(schedule)); clearInvocations(mockEngine); inAppAutomation.setPaused(false); verify(mockEngine).checkPendingSchedules(); assertEquals(AutomationDriver.READY_RESULT_CONTINUE, driver.onCheckExecutionReadiness(schedule)); }