01: /*
02: * Copyright (C) 2005 Joe Walnes.
03: * Copyright (C) 2006, 2007 XStream Committers.
04: * All rights reserved.
05: *
06: * The software in this package is published under the terms of the BSD
07: * style license a copy of which has been included with this distribution in
08: * the LICENSE.txt file.
09: *
10: * Created on 09. April 2005 by Joe Walnes
11: */
12: package com.thoughtworks.xstream.mapper;
13:
14: import com.thoughtworks.acceptance.AbstractAcceptanceTest;
15: import com.thoughtworks.acceptance.objects.Software;
16:
17: public class FieldAliasingMapperTest extends AbstractAcceptanceTest {
18:
19: public void testAllowsIndividualFieldsToBeAliased() {
20: Software in = new Software("ms", "word");
21: xstream.alias("software", Software.class);
22: xstream.aliasField("CUSTOM-VENDOR", Software.class, "vendor");
23: xstream.aliasField("CUSTOM-NAME", Software.class, "name");
24:
25: String expectedXml = "" + "<software>\n"
26: + " <CUSTOM-VENDOR>ms</CUSTOM-VENDOR>\n"
27: + " <CUSTOM-NAME>word</CUSTOM-NAME>\n" + "</software>";
28:
29: assertBothWays(in, expectedXml);
30: }
31: }
|