Package com.thoughtworks.acceptance.objects

Examples of com.thoughtworks.acceptance.objects.Software


     */
    public void testWithValueInConvertedClass() {
        converterLookup.registerConverter(new ToAttributedValueConverter(
            Software.class, mapper, reflectionProvider, converterLookup, "name"), 0);

        final Software name = new Software(null, "XStream");
        final StringWriter writer = new StringWriter();
        final CompactWriter compactWriter = new CompactWriter(writer);
        new TreeMarshaller(compactWriter, converterLookup, mapper).start(name, null);
        compactWriter.flush();
        assertEquals("<software>XStream</software>", writer.toString());
View Full Code Here


    public void testWithValueInSuperclass() {
        converterLookup.registerConverter(new ToAttributedValueConverter(
            OpenSourceSoftware.class, mapper, reflectionProvider, converterLookup, "name",
            Software.class), 0);

        final Software software = new OpenSourceSoftware("Codehaus", "XStream", "BSD");
        final StringWriter writer = new StringWriter();
        final CompactWriter compactWriter = new CompactWriter(writer);
        new TreeMarshaller(compactWriter, converterLookup, mapper).start(software, null);
        compactWriter.flush();
        assertEquals(
View Full Code Here

            new ToAttributedValueConverter(
                OpenSourceSoftware.class, mapper, reflectionProvider, converterLookup,
                "license"), 0);

        final Software[] software = new Software[]{
            new Software("Microsoft", "Windows"),
            new OpenSourceSoftware("Codehaus", "XStream", "BSD")};
        final StringWriter writer = new StringWriter();
        final PrettyPrintWriter prettyPrintWriter = new PrettyPrintWriter(writer);
        new TreeMarshaller(prettyPrintWriter, converterLookup, mapper).start(software, null);
        prettyPrintWriter.flush();
View Full Code Here

     */
    public void testWithNullValueDeserializedAsEmptyString() {
        converterLookup.registerConverter(new ToAttributedValueConverter(
            Software.class, mapper, reflectionProvider, converterLookup, "name"), 0);

        final Software software = new Software(null, null);
        final StringWriter writer = new StringWriter();
        final CompactWriter compactWriter = new CompactWriter(writer);
        new TreeMarshaller(compactWriter, converterLookup, mapper).start(software, null);
        compactWriter.flush();
        assertEquals("<software/>", writer.toString());
View Full Code Here

     */
    public void testWithoutValueField() {
        converterLookup.registerConverter(new ToAttributedValueConverter(
            Software.class, mapper, reflectionProvider, converterLookup, null), 0);

        final Software software = new Software("Codehaus", "XStream");
        final StringWriter writer = new StringWriter();
        final CompactWriter compactWriter = new CompactWriter(writer);
        new TreeMarshaller(compactWriter, converterLookup, mapper).start(software, null);
        compactWriter.flush();
        assertEquals("<software vendor=\"Codehaus\" name=\"XStream\"/>", writer.toString());
View Full Code Here

import com.thoughtworks.acceptance.objects.Software;

public class FieldAliasingMapperTest extends AbstractAcceptanceTest {

    public void testAllowsIndividualFieldsToBeAliased() {
        Software in = new Software("ms", "word");
        xstream.alias("software", Software.class);
        xstream.aliasField("CUSTOM-VENDOR", Software.class, "vendor");
        xstream.aliasField("CUSTOM-NAME", Software.class, "name");

        String expectedXml = "" +
View Full Code Here

    }

    private void test(HierarchicalStreamDriver driver) {
        XStream xstream = new XStream(driver);

        Object in = new Software("some vendor", "some name");
        String xml = xstream.toXML(in);
        Object out = xstream.fromXML(xml);

        Assert.assertEquals(in, out);
    }
View Full Code Here

        assertBothWays(x, xml);
    }
   
    public void testForFieldAsAttribute() {
        Software software = new Software("walness", "xstream");
       
        xstream.alias("software", Software.class);
        xstream.useAttributeFor(String.class);
        xstream.aliasAttribute("id", "name");
       
View Full Code Here

        assertBothWays(software, xml);
    }
   
    public void testForReferenceSystemAttribute() {
        List list = new ArrayList();
        Software software = new Software("walness", "xstream");
        list.add(software);
        list.add(software);
       
        xstream.alias("software", Software.class);
        xstream.useAttributeFor(String.class);
View Full Code Here

       
        assertBothWays(category, xml);
    }
   
    public void testIdentityForFields() {
        Software software = 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

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.