Package com.thoughtworks.acceptance.objects

Examples of com.thoughtworks.acceptance.objects.Software


            + "</test>";
        assertBothWays(object, xml);
    }

    public void testCanAliasArrayElements() {
        Object[] software = new Object[]{new Software("walness", "xstream")};

        xstream.alias("software", Software.class);
        xstream.aliasField("Name", Software.class, "name");
        xstream.aliasField("Vendor", Software.class, "vendor");
       
View Full Code Here


       
        assertBothWays(software, xml);
    }
   
    public void testCanAliasCompletePackage() {
        Software software = new Software("walness", "xstream");
        xstream.aliasPackage("org.codehaus", "com.thoughtworks.acceptance.objects");
       
        String xml = "" //
            + "<org.codehaus.Software>\n"
            + "  <vendor>walness</vendor>\n"
View Full Code Here

       
        assertBothWays(software, xml);
    }
   
    public void testCanAliasSubPackage() {
        Software software = new Software("walness", "xstream");
        xstream.aliasPackage("org.codehaus", "com.thoughtworks");
       
        String xml = "" //
            + "<org.codehaus.acceptance.objects.Software>\n"
            + "  <vendor>walness</vendor>\n"
View Full Code Here

       
        assertBothWays(software, xml);
    }
   
    public void testToDefaultPackage() {
        Software software = new Software("walness", "xstream");
        xstream.aliasPackage("", "com.thoughtworks.acceptance.objects");
       
        String xml = "" //
            + "<Software>\n"
            + "  <vendor>walness</vendor>\n"
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");
       
        String xml = "" //
View Full Code Here

        }

    }

    public void testCanBeUsedForCustomTypes() {
        Software software = new Software("Joe Walnes", "XStream");
        SingleValueConverter converter = new PropertyEditorCapableConverter(
            SoftwarePropertyEditor.class, Software.class);
        assertTrue(converter.canConvert(Software.class));
        assertEquals("Joe Walnes:XStream", converter.toString(software));
        assertEquals(software, converter.fromString("Joe Walnes:XStream"));
View Full Code Here

        final int[] counter = new int[1];
        counter[0] = 0;
        final Thread[] threads = new Thread[10];
        for (int i = 0; i < threads.length; ++i) {
            final String name = "JUnit Thread:" + i;
            references.put(name, new Software("JUnit Thread", Integer.toString(i)));
            threads[i] = new Thread(tg, name) {

                public void run() {
                    int i = 0;
                    try {
                        synchronized (this) {
                            notifyAll();
                            wait();
                        }
                        final Software software = (Software)references.get(Thread
                            .currentThread()
                            .getName());
                        while (i < 1000 && !interrupted()) {
                            String formatted = converter.toString(software);
                            Thread.yield();
View Full Code Here

public class PropertyEditorCapableConverterTest extends TestCase {

    public static class SoftwarePropertyEditor extends PropertyEditorSupport {

        public String getAsText() {
            Software software = (Software)getValue();
            return software.vendor + ":" + software.name;
        }
View Full Code Here

            return software.vendor + ":" + software.name;
        }

        public void setAsText(String text) throws IllegalArgumentException {
            int idx = text.indexOf(':');
            setValue(new Software(text.substring(0, idx), text.substring(idx + 1)));
        }
View Full Code Here

TOP

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

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.