treemarshallertest.java

来自「xstream是一个把java object序列化成xml文件的开源库,轻便好用」· Java 代码 · 共 31 行

JAVA
31
字号
package com.thoughtworks.xstream.core;import com.thoughtworks.acceptance.AbstractAcceptanceTest;import com.thoughtworks.xstream.XStream;public class TreeMarshallerTest extends AbstractAcceptanceTest {    class Thing {        Thing thing;    }    protected void setUp() throws Exception {        super.setUp();        xstream.setMode(XStream.NO_REFERENCES);    }    public void testThrowsExceptionWhenDetectingCircularReferences() {        Thing a = new Thing();        Thing b = new Thing();        a.thing = b;        b.thing = a;        try {            xstream.toXML(a);            fail("expected exception");        } catch (TreeMarshaller.CircularReferenceException expected) {            // good        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?