Package com.thoughtworks.acceptance.objects

Examples of com.thoughtworks.acceptance.objects.Category


        assertBothWays(list, xml);
    }
   
    public void testForSystemAttributes() {
        List list = new LinkedList();
        Category category = new Category("walness", "xstream");
        category.setProducts(list);
        list.add(category);
       
        xstream.alias("category", Category.class);
        xstream.useAttributeFor(Category.class, "id");
        xstream.aliasAttribute("class", "id");
View Full Code Here


        String result = xstream.toXML(product);
        assertEquals(SIMPLE, result);
    }

    public void testWriteHierarchy() {
        Category category = new Category("fruit", "111");
        ArrayList products = new ArrayList();
        Product banana = new Product("Banana", "123", 23.01);
        ArrayList bananaTags = new ArrayList();
        bananaTags.add("yellow");
        bananaTags.add("fresh");
        bananaTags.add("tasty");
        banana.setTags(bananaTags);
        products.add(banana);
        Product mango = new Product("Mango", "124", 34.01);
        products.add(mango);
        category.setProducts(products);
        String result = xstream.toXML(category);
        assertEquals(HIERARCHY, result);
    }
View Full Code Here

        String result = xstream.toXML(category);
        assertEquals(HIERARCHY, result);
    }

    public void testHierarchyRead() {
        Category parsedCategory = (Category)xstream.fromXML(HIERARCHY);
        Product parsedBanana = (Product)parsedCategory.getProducts().get(0);
        assertEquals("Banana", parsedBanana.getName());
        assertEquals(3, parsedBanana.getTags().size());
        assertEquals("yellow", parsedBanana.getTags().get(0));
        assertEquals("tasty", parsedBanana.getTags().get(2));
    }
View Full Code Here

TOP

Related Classes of com.thoughtworks.acceptance.objects.Category

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.