@Test public void testUpdateUserAndroid() { runtimeConfig.setPlatform(UAirship.ANDROID_PLATFORM); when(mockChannel.getId()).thenReturn("ba7beaaf-b6e9-416c-a1f9-a6ff5a81f588"); user.setUser("someUserId", "someUserToken"); responses.put("https: new Response.Builder<Void>(HttpURLConnection.HTTP_OK) .setResponseBody("{ \"ok\" }") .build()); JobInfo jobInfo = JobInfo.newBuilder() .setAction(InboxJobHandler.ACTION_RICH_PUSH_USER_UPDATE) .build(); assertEquals(JobInfo.JOB_FINISHED, jobHandler.performJob(jobInfo)); assertTrue(userListener.lastUpdateUserResult); assertEquals(requests.size(), 1); assertEquals("POST", requests.get(0).getRequestMethod()); assertEquals("https: assertEquals("{\"android_channels\":{\"add\":[\"ba7beaaf-b6e9-416c-a1f9-a6ff5a81f588\"]}}", requests.get(0).getRequestBody()); assertEquals("application/vnd.urbanairship+json; version=3;", requests.get(0).getRequestHeaders().get("Accept")); }
@JobInfo.JobResult int performJob(@NonNull JobInfo jobInfo) { switch (jobInfo.getAction()) { case ACTION_RICH_PUSH_USER_UPDATE: onUpdateUser(jobInfo.getExtras().opt(EXTRA_FORCEFULLY).getBoolean(false)); break; case ACTION_RICH_PUSH_MESSAGES_UPDATE: onUpdateMessages(); break; case ACTION_SYNC_MESSAGE_STATE: onSyncMessages(); break; } return JobInfo.JOB_FINISHED; }
InboxJobHandler { @JobInfo.JobResult int performJob(@NonNull JobInfo jobInfo) { switch (jobInfo.getAction()) { case ACTION_RICH_PUSH_USER_UPDATE: onUpdateUser(jobInfo.getExtras().opt(EXTRA_FORCEFULLY).getBoolean(false)); break; case ACTION_RICH_PUSH_MESSAGES_UPDATE: onUpdateMessages(); break; case ACTION_SYNC_MESSAGE_STATE: onSyncMessages(); break; } return JobInfo.JOB_FINISHED; } }
InboxJobHandler { @JobInfo.JobResult int performJob(@NonNull JobInfo jobInfo) { switch (jobInfo.getAction()) { case ACTION_RICH_PUSH_USER_UPDATE: onUpdateUser(jobInfo.getExtras().opt(EXTRA_FORCEFULLY).getBoolean(false)); break; case ACTION_RICH_PUSH_MESSAGES_UPDATE: onUpdateMessages(); break; case ACTION_SYNC_MESSAGE_STATE: onSyncMessages(); break; } return JobInfo.JOB_FINISHED; } InboxJobHandler(@NonNull Context context,
                    @NonNull Inbox inbox,
                    @NonNull User user,
                    @NonNull AirshipChannel channel,
                    @NonNull AirshipRuntimeConfig runtimeConfig,
                    @NonNull PreferenceDataStore dataStore); @VisibleForTesting  InboxJobHandler(@NonNull Inbox inbox,
                    @NonNull User user,
                    @NonNull AirshipChannel channel,
                    @NonNull AirshipRuntimeConfig runtimeConfig,
                    @NonNull PreferenceDataStore dataStore,
                    @NonNull RequestFactory requestFactory,
                    @NonNull MessageCenterResolver resolver); }
InboxJobHandler { @JobInfo.JobResult int performJob(@NonNull JobInfo jobInfo) { switch (jobInfo.getAction()) { case ACTION_RICH_PUSH_USER_UPDATE: onUpdateUser(jobInfo.getExtras().opt(EXTRA_FORCEFULLY).getBoolean(false)); break; case ACTION_RICH_PUSH_MESSAGES_UPDATE: onUpdateMessages(); break; case ACTION_SYNC_MESSAGE_STATE: onSyncMessages(); break; } return JobInfo.JOB_FINISHED; } InboxJobHandler(@NonNull Context context,
                    @NonNull Inbox inbox,
                    @NonNull User user,
                    @NonNull AirshipChannel channel,
                    @NonNull AirshipRuntimeConfig runtimeConfig,
                    @NonNull PreferenceDataStore dataStore); @VisibleForTesting  InboxJobHandler(@NonNull Inbox inbox,
                    @NonNull User user,
                    @NonNull AirshipChannel channel,
                    @NonNull AirshipRuntimeConfig runtimeConfig,
                    @NonNull PreferenceDataStore dataStore,
                    @NonNull RequestFactory requestFactory,
                    @NonNull MessageCenterResolver resolver);  }
InboxJobHandler { @JobInfo.JobResult int performJob(@NonNull JobInfo jobInfo) { switch (jobInfo.getAction()) { case ACTION_RICH_PUSH_USER_UPDATE: onUpdateUser(jobInfo.getExtras().opt(EXTRA_FORCEFULLY).getBoolean(false)); break; case ACTION_RICH_PUSH_MESSAGES_UPDATE: onUpdateMessages(); break; case ACTION_SYNC_MESSAGE_STATE: onSyncMessages(); break; } return JobInfo.JOB_FINISHED; } InboxJobHandler(@NonNull Context context,
                    @NonNull Inbox inbox,
                    @NonNull User user,
                    @NonNull AirshipChannel channel,
                    @NonNull AirshipRuntimeConfig runtimeConfig,
                    @NonNull PreferenceDataStore dataStore); @VisibleForTesting  InboxJobHandler(@NonNull Inbox inbox,
                    @NonNull User user,
                    @NonNull AirshipChannel channel,
                    @NonNull AirshipRuntimeConfig runtimeConfig,
                    @NonNull PreferenceDataStore dataStore,
                    @NonNull RequestFactory requestFactory,
                    @NonNull MessageCenterResolver resolver);   }