📄 xpathduplicatereferencetest.java
字号:
package com.thoughtworks.acceptance;import com.thoughtworks.xstream.XStream;import java.util.ArrayList;import java.util.List;public class XPathDuplicateReferenceTest extends AbstractDuplicateReferenceTest { // tests inherited from superclass protected void setUp() throws Exception { super.setUp(); xstream.setMode(XStream.XPATH_REFERENCES); } public void testXmlContainsReferencePaths() { Thing sameThing = new Thing("hello"); Thing anotherThing = new Thing("hello"); List list = new ArrayList(); list.add(sameThing); list.add(sameThing); list.add(anotherThing); String expected = "" + "<list>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + " <thing reference=\"../thing\"/>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + "</list>"; assertEquals(expected, xstream.toXML(list)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -