urbanairship-core/src/test/java/com/urbanairship/ChannelCaptureTest.java
@Test
    public void testChannelCaptureDisabled() {
        // Disable the channel capture
        configOptions = new AirshipConfigOptions.Builder()
                .setDevelopmentAppKey("appKey")
                .setDevelopmentAppSecret("appSecret")
                .setChannelCaptureEnabled(false)
                .build();

        // Reinitialize it
        capture.tearDown();
        capture = new ChannelCapture(RuntimeEnvironment.application, configOptions, mockPushManager, dataStore, activityMonitor);

        // Replace the executor so it runs everything right away
        capture.executor = new Executor() {
            @Override
            public void execute(Runnable runnable) {
                runnable.run();
            }
        };
        capture.init();

        // Set up a valid token
        when(mockPushManager.getChannelId()).thenReturn("channel ID");
        clipboardManager.setPrimaryClip(ClipData.newPlainText("Channel", generateToken(null)));

        activityMonitor.startActivity();

        // Verify we did not post a notification TODO
        assertEquals(shadowOf(RuntimeEnvironment.application).getNextStartedActivity(), null);
    }
/**
     * Test disabling the channel capture through AirshipConfigOptions.
     */
Test disabling the channel capture through AirshipConfigOptions.
Test disabling the channel capture through AirshipConfigOptions .
@Test
    public void testChannelCaptureDisabled() {
        configOptions = new AirshipConfigOptions.Builder()
                .setDevelopmentAppKey("appKey")
                .setDevelopmentAppSecret("appSecret")
                .setChannelCaptureEnabled(false)
                .build();
        capture.tearDown();
        capture = new ChannelCapture(RuntimeEnvironment.application, configOptions, mockPushManager, dataStore, activityMonitor);
        capture.executor = new Executor() {
            @Override
            public void execute(Runnable runnable) {
                runnable.run();
            }
        };
        capture.init();
        when(mockPushManager.getChannelId()).thenReturn("channel ID");
        clipboardManager.setPrimaryClip(ClipData.newPlainText("Channel", generateToken(null)));
        activityMonitor.startActivity();
        assertEquals(shadowOf(RuntimeEnvironment.application).getNextStartedActivity(), null);
    }
@ Test public void testChannelCaptureDisabled ( ) { configOptions = new AirshipConfigOptions . Builder ( ) . setDevelopmentAppKey ( "appKey" ) . setDevelopmentAppSecret ( "appSecret" ) . setChannelCaptureEnabled ( false ) . build ( ) ; capture . tearDown ( ) ; capture = new ChannelCapture ( RuntimeEnvironment . application , configOptions , mockPushManager , dataStore , activityMonitor ) ; capture . executor = new Executor ( ) { @ Override public void execute ( Runnable runnable ) { runnable . run ( ) ; } } ; capture . init ( ) ; when ( mockPushManager . getChannelId ( ) ) . thenReturn ( "channel ID" ) ; clipboardManager . setPrimaryClip ( ClipData . newPlainText ( "Channel" , generateToken ( null ) ) ) ; activityMonitor . startActivity ( ) ; assertEquals ( shadowOf ( RuntimeEnvironment . application ) . getNextStartedActivity ( ) , null ) ; }
Test disabling the channel capture through AirshipConfigOptions.
Test disabling the channel capture through AirshipConfigOptions .
// Disable the channel capture // Reinitialize it // Replace the executor so it runs everything right away // Set up a valid token // Verify we did not post a notification TODO