Code example for Intent

Methods: getCategories, hasCategory, removeCategory

0
        assertSame(self, intent);
    } 
 
    @Test 
    public void shouldSupportCategories() throws Exception { 
        Intent intent = new Intent();
        Intent self = intent.addCategory("category.name.1");
        intent.addCategory("category.name.2");
 
        assertTrue(intent.hasCategory("category.name.1"));
        assertTrue(intent.hasCategory("category.name.2"));
 
        Set<String> categories = intent.getCategories();
        assertTrue(categories.contains("category.name.1"));
        assertTrue(categories.contains("category.name.2"));
 
        intent.removeCategory("category.name.1");
        assertFalse(intent.hasCategory("category.name.1"));
        assertTrue(intent.hasCategory("category.name.2"));
 
        intent.removeCategory("category.name.2");
        assertFalse(intent.hasCategory("category.name.2"));
 
        assertEquals(0, intent.getCategories().size());
 
        assertSame(self, intent);
    } 
 
    @Test