urbanairship-core/src/test/java/com/urbanairship/js/WhitelistTest.java
@Test
    public void testHostWildCard() {
        assertTrue(whitelist.addEntry("http://*", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.addEntry("https://*.coolstory", Whitelist.SCOPE_ALL));

        // * is only available at the beginning
        assertFalse(whitelist.addEntry("https://*.coolstory.*", Whitelist.SCOPE_ALL));

        // Reject
        assertFalse(whitelist.isWhitelisted(null, Whitelist.SCOPE_ALL));
        assertFalse(whitelist.isWhitelisted("", Whitelist.SCOPE_ALL));
        assertFalse(whitelist.isWhitelisted("https://cool", Whitelist.SCOPE_ALL));
        assertFalse(whitelist.isWhitelisted("https://story", Whitelist.SCOPE_ALL));

        // Accept
        assertTrue(whitelist.isWhitelisted("http://what.urbanairship.com", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("http:///android-asset/test.html", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("http://www.anything.com", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("https://coolstory", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("https://what.coolstory", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("https://what.what.coolstory", Whitelist.SCOPE_ALL));

    }
/**
     * Test wild card in the host.
     */
Test wild card in the host.
Test wild card in the host .
@Test
    public void testHostWildCard() {
        assertTrue(whitelist.addEntry("http://*", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.addEntry("https://*.coolstory", Whitelist.SCOPE_ALL));
        assertFalse(whitelist.addEntry("https://*.coolstory.*", Whitelist.SCOPE_ALL));
        assertFalse(whitelist.isWhitelisted(null, Whitelist.SCOPE_ALL));
        assertFalse(whitelist.isWhitelisted("", Whitelist.SCOPE_ALL));
        assertFalse(whitelist.isWhitelisted("https://cool", Whitelist.SCOPE_ALL));
        assertFalse(whitelist.isWhitelisted("https://story", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("http://what.urbanairship.com", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("http:///android-asset/test.html", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("http://www.anything.com", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("https://coolstory", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("https://what.coolstory", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("https://what.what.coolstory", Whitelist.SCOPE_ALL));
    }
@ Test public void testHostWildCard ( ) { assertTrue ( whitelist . addEntry ( "http://*" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . addEntry ( "https://*.coolstory" , Whitelist . SCOPE_ALL ) ) ; assertFalse ( whitelist . addEntry ( "https://*.coolstory.*" , Whitelist . SCOPE_ALL ) ) ; assertFalse ( whitelist . isWhitelisted ( null , Whitelist . SCOPE_ALL ) ) ; assertFalse ( whitelist . isWhitelisted ( "" , Whitelist . SCOPE_ALL ) ) ; assertFalse ( whitelist . isWhitelisted ( "https://cool" , Whitelist . SCOPE_ALL ) ) ; assertFalse ( whitelist . isWhitelisted ( "https://story" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . isWhitelisted ( "http://what.urbanairship.com" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . isWhitelisted ( "http:///android-asset/test.html" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . isWhitelisted ( "http://www.anything.com" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://coolstory" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://what.coolstory" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://what.what.coolstory" , Whitelist . SCOPE_ALL ) ) ; }
Test wild card in the host.
Test wild card in the host .
// * is only available at the beginning // Reject // Accept