urbanairship-core/src/test/java/com/urbanairship/push/IncomingPushRunnableTest.java
@Test
    @Config(sdk = 25)
    public void testDeliverPushVibrateDisabled() {
        when(pushManager.isComponentEnabled()).thenReturn(true);
        when(pushManager.isPushEnabled()).thenReturn(true);
        when(pushManager.isOptIn()).thenReturn(true);
        when(pushManager.isUniqueCanonicalId("testPushID")).thenReturn(true);

        // Disable vibrate
        when(pushManager.isVibrateEnabled()).thenReturn(false);

        notification.defaults = NotificationCompat.DEFAULT_ALL;
        notification.vibrate = new long[] { 0L, 1L, 200L };

        pushRunnable.run();

        assertNull("The notification sound should be null.", notification.vibrate);
        assertEquals("The notification defaults should not include DEFAULT_VIBRATE.",
                notification.defaults & NotificationCompat.DEFAULT_VIBRATE, 0);
    }
/**
     * Test when sound is disabled the flag for DEFAULT_VIBRATE is removed and the notification vibrate
     * is set to null.
     */
Test when sound is disabled the flag for DEFAULT_VIBRATE is removed and the notification vibrate
is set to null.
Test when sound is disabled the flag for DEFAULT_VIBRATE is removed and the notification vibrate is set to null .
@Test
    @Config(sdk = 25)
    public void testDeliverPushVibrateDisabled() {
        when(pushManager.isComponentEnabled()).thenReturn(true);
        when(pushManager.isPushEnabled()).thenReturn(true);
        when(pushManager.isOptIn()).thenReturn(true);
        when(pushManager.isUniqueCanonicalId("testPushID")).thenReturn(true);
        when(pushManager.isVibrateEnabled()).thenReturn(false);
        notification.defaults = NotificationCompat.DEFAULT_ALL;
        notification.vibrate = new long[] { 0L, 1L, 200L };
        pushRunnable.run();
        assertNull("The notification sound should be null.", notification.vibrate);
        assertEquals("The notification defaults should not include DEFAULT_VIBRATE.",
                notification.defaults & NotificationCompat.DEFAULT_VIBRATE, 0);
    }
@ Test @ Config ( sdk = 25 ) public void testDeliverPushVibrateDisabled ( ) { when ( pushManager . isComponentEnabled ( ) ) . thenReturn ( true ) ; when ( pushManager . isPushEnabled ( ) ) . thenReturn ( true ) ; when ( pushManager . isOptIn ( ) ) . thenReturn ( true ) ; when ( pushManager . isUniqueCanonicalId ( "testPushID" ) ) . thenReturn ( true ) ; when ( pushManager . isVibrateEnabled ( ) ) . thenReturn ( false ) ; notification . defaults = NotificationCompat . DEFAULT_ALL ; notification . vibrate = new long [ ] { 0L , 1L , 200L } ; pushRunnable . run ( ) ; assertNull ( "The notification sound should be null." , notification . vibrate ) ; assertEquals ( "The notification defaults should not include DEFAULT_VIBRATE." , notification . defaults & NotificationCompat . DEFAULT_VIBRATE , 0 ) ; }
Test when sound is disabled the flag for DEFAULT_VIBRATE is removed and the notification vibrate
 is set to null.
Test when sound is disabled the flag for DEFAULT_VIBRATE is removed and the notification vibrate is set to null .
// Disable vibrate