urbanairship-core/src/test/java/com/urbanairship/push/PushManagerJobHandlerTest.java
@Test
    public void testCreateChannelTooManyRequests() {
        // Set up channel response
        Response response = mock(Response.class);
        when(response.getStatus()).thenReturn(Response.HTTP_TOO_MANY_REQUESTS);

        ChannelRegistrationPayload payload = pushManager.getNextChannelRegistrationPayload();

        // Return the response
        when(client.createChannelWithPayload(payload)).thenReturn(response);

        JobInfo jobInfo = JobInfo.newBuilder().setAction(PushManagerJobHandler.ACTION_UPDATE_CHANNEL_REGISTRATION).build();
        assertEquals(JobInfo.JOB_RETRY, jobHandler.performJob(jobInfo));
    }
/**
     * Test creating channel returns a retry when the status code is 429.
     */
Test creating channel returns a retry when the status code is 429.
Test creating channel returns a retry when the status code is 429 .
@Test
    public void testCreateChannelTooManyRequests() {
        Response response = mock(Response.class);
        when(response.getStatus()).thenReturn(Response.HTTP_TOO_MANY_REQUESTS);
        ChannelRegistrationPayload payload = pushManager.getNextChannelRegistrationPayload();
        when(client.createChannelWithPayload(payload)).thenReturn(response);
        JobInfo jobInfo = JobInfo.newBuilder().setAction(PushManagerJobHandler.ACTION_UPDATE_CHANNEL_REGISTRATION).build();
        assertEquals(JobInfo.JOB_RETRY, jobHandler.performJob(jobInfo));
    }
@ Test public void testCreateChannelTooManyRequests ( ) { Response response = mock ( Response . class ) ; when ( response . getStatus ( ) ) . thenReturn ( Response . HTTP_TOO_MANY_REQUESTS ) ; ChannelRegistrationPayload payload = pushManager . getNextChannelRegistrationPayload ( ) ; when ( client . createChannelWithPayload ( payload ) ) . thenReturn ( response ) ; JobInfo jobInfo = JobInfo . newBuilder ( ) . setAction ( PushManagerJobHandler . ACTION_UPDATE_CHANNEL_REGISTRATION ) . build ( ) ; assertEquals ( JobInfo . JOB_RETRY , jobHandler . performJob ( jobInfo ) ) ; }
Test creating channel returns a retry when the status code is 429.
Test creating channel returns a retry when the status code is 429 .
// Set up channel response // Return the response