Package com.thoughtworks.acceptance.someobjects

Examples of com.thoughtworks.acceptance.someobjects.WithList


        assertEquals(999, funnyConstructor.i);
    }

    public void testHandlesLists() {
        WithList original = new WithList();
        Y y = new Y();
        y.yField = "a";
        original.things.add(y);
        original.things.add(new X(3));
        original.things.add(new X(1));

        String xml = xstream.toXML(original);

        String expected =
                "<with-list>\n" +
                "  <things>\n" +
                "    <y>\n" +
                "      <yField>a</yField>\n" +
                "    </y>\n" +
                "    <x>\n" +
                "      <anInt>3</anInt>\n" +
                "    </x>\n" +
                "    <x>\n" +
                "      <anInt>1</anInt>\n" +
                "    </x>\n" +
                "  </things>\n" +
                "</with-list>";

        assertEquals(expected, xml);

        WithList result = (WithList) xstream.fromXML(xml);
        assertEquals(original, result);

    }
View Full Code Here


       
        assertBothWays(software, xml);
    }
   
    public void testForLongerPackageNameTakesPrecedence() {
        WithList withList = new WithList();
        withList.things.add(new Software("walness", "xstream"));
        withList.things.add(new TypeA());
        xstream.aliasPackage("model", "com.thoughtworks.acceptance.objects");
        xstream.aliasPackage("org.codehaus", "com.thoughtworks");
        xstream.aliasPackage("model.foo", "com.thoughtworks.acceptance.someobjects");
View Full Code Here

        assertBothWays(withList, xml);
    }
   
    public void testClassTakesPrecedenceOfPackage() {
        WithList withList = new WithList();
        withList.things.add(new Software("walness", "xstream"));
        xstream.alias("MySoftware", Software.class);
        xstream.aliasPackage("org.codehaus", "com.thoughtworks");
        xstream.aliasPackage("model.foo", "com.thoughtworks.acceptance.someobjects");
       
View Full Code Here

    public void testUsingNamespace() {
        // lets register some qnames
        QName qname = new QName(namespace, "withList", "w");
        qnameMap.registerMapping(qname, WithList.class);

        WithList withList = new WithList();
        withList.things = new ArrayList();

        String expected ="" +
                XML_HEADER +
                "<w:withList xmlns:w=\"java://com.thoughtworks.acceptance.someobjects\">" +
View Full Code Here

    public void testUsingDefaultNamespace() {
        qnameMap.setDefaultNamespace(namespace);
        xstream.alias("withList", WithList.class);

        WithList withList = new WithList();
        withList.things = new ArrayList();

        String expected =
                XML_HEADER +
                "<withList xmlns=\"java://com.thoughtworks.acceptance.someobjects\">" +
View Full Code Here

        qnameMap.setDefaultNamespace(namespace);
        qnameMap.setDefaultPrefix("x");
        QName qname = new QName(namespace, "withList", "x");
        qnameMap.registerMapping(qname, WithList.class);

        WithList withList = new WithList();
        withList.things = new ArrayList();

        String expected =
                XML_HEADER +
                "<x:withList xmlns:x=\"java://com.thoughtworks.acceptance.someobjects\">" +
View Full Code Here

    public void testUsingDifferentNamespaces() {
        // lets register some qnames
        qnameMap.registerMapping(new QName(namespace, "withList", "w"), WithList.class);
        qnameMap.registerMapping(new QName("urn:foo", "things", "f"), "things");

        WithList withList = new WithList();
        withList.things = new ArrayList();

        String expected =
                XML_HEADER +
                "<w:withList xmlns:w=\"java://com.thoughtworks.acceptance.someobjects\">" +
View Full Code Here

    public void testDefaultImplementationOfInterface() {

        xstream.alias("with-list", WithList.class);

        WithList withList = new WithList();
        withList.things = new ArrayList();

        String expected =
                "<with-list>\n" +
                "  <things/>\n" +
View Full Code Here

    public void testAlternativeImplementationOfInterface() {

        xstream.alias("with-list", WithList.class);
        xstream.alias("linked-list", LinkedList.class);

        WithList withList = new WithList();
        withList.things = new LinkedList();

        String expected =
                "<with-list>\n" +
                "  <things class=\"linked-list\"/>\n" +
View Full Code Here

                };
            }

        };
        xstream.alias("wl", WithList.class);
        WithList wl = (WithList)xstream.fromXML(""
                + "<wl>\n"
                + "  <things class='UnknownList'>\n"
                + "    <foo>1</foo>\n"
                + "    <cocoo>2</cocoo>\n"
                + "  </things>\n"
View Full Code Here

TOP

Related Classes of com.thoughtworks.acceptance.someobjects.WithList

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.