|
From: <tri...@us...> - 2008-01-30 08:13:58
|
Revision: 286
http://equanda.svn.sourceforge.net/equanda/?rev=286&view=rev
Author: triathlon98
Date: 2008-01-30 00:13:56 -0800 (Wed, 30 Jan 2008)
Log Message:
-----------
EQ-53 extra tests
Modified Paths:
--------------
trunk/equanda-generate/src/main/java/org/equanda/domain/xml/Compare.java
trunk/equanda-generate/src/main/java/org/equanda/domain/xml/Constraints.java
trunk/equanda-generate/src/main/java/org/equanda/domain/xml/DataFilter.java
trunk/equanda-generate/src/main/java/org/equanda/domain/xml/OverwriteDefault.java
trunk/equanda-generate/src/main/java/org/equanda/domain/xml/aid/OverwriteDefaultConverter.java
trunk/equanda-generate/src/main/resources/equanda.dtd
Added Paths:
-----------
trunk/equanda-generate/src/main/java/org/equanda/domain/xml/aid/DataFilterConverter.java
trunk/equanda-generate/src/test/java/org/equanda/domain/xml/CompareTest.java
trunk/equanda-generate/src/test/java/org/equanda/domain/xml/ConstraintsTest.java
trunk/equanda-generate/src/test/java/org/equanda/domain/xml/DataFilterTest.java
trunk/equanda-generate/src/test/java/org/equanda/domain/xml/OverwriteDefaultTest.java
Modified: trunk/equanda-generate/src/main/java/org/equanda/domain/xml/Compare.java
===================================================================
--- trunk/equanda-generate/src/main/java/org/equanda/domain/xml/Compare.java 2008-01-29 15:23:02 UTC (rev 285)
+++ trunk/equanda-generate/src/main/java/org/equanda/domain/xml/Compare.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -45,14 +45,6 @@
@XStreamAsAttribute
private String right;
-/*<!ELEMENT compare EMPTY>
-<!ATTLIST compare
-test CDATA #REQUIRED
-value CDATA #IMPLIED
-left CDATA #IMPLIED
-right CDATA #IMPLIED>
-*/
-
@XStreamOmitField
private boolean fieldLevel;
@XStreamOmitField
Modified: trunk/equanda-generate/src/main/java/org/equanda/domain/xml/Constraints.java
===================================================================
--- trunk/equanda-generate/src/main/java/org/equanda/domain/xml/Constraints.java 2008-01-29 15:23:02 UTC (rev 285)
+++ trunk/equanda-generate/src/main/java/org/equanda/domain/xml/Constraints.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -40,8 +40,9 @@
@XStreamAlias( "constraints" )
public class Constraints
{
- // @todo unique
@XStreamConverter( ImplicitBooleanConverter.class )
+ private boolean unique;
+ @XStreamConverter( ImplicitBooleanConverter.class )
private boolean required;
@XStreamConverter( ImplicitBooleanConverter.class )
private boolean immutable;
@@ -53,12 +54,11 @@
private List<MutableEvenIf> mutableEvenIf;
@XStreamImplicit
private List<Compare> compare;
- // @todo value-when-null
- // @todo value-when-zero
+ @XStreamAlias( "value-when-null" )
+ private ValueWhenNull valueWhenNull;
+ @XStreamAlias( "value-when-zero" )
+ private ValueWhenNull valueWhenZero;
-/*<!ELEMENT constraints (unique|required|immutable|immutable-if|mutable-even-if|compare|value-when-null|value-when-zero)*>
-*/
-
public boolean isRequired()
{
return required;
@@ -83,4 +83,19 @@
{
return compare;
}
+
+ public boolean isUnique()
+ {
+ return unique;
+ }
+
+ public ValueWhenNull getValueWhenNull()
+ {
+ return valueWhenNull;
+ }
+
+ public ValueWhenNull getValueWhenZero()
+ {
+ return valueWhenZero;
+ }
}
Modified: trunk/equanda-generate/src/main/java/org/equanda/domain/xml/DataFilter.java
===================================================================
--- trunk/equanda-generate/src/main/java/org/equanda/domain/xml/DataFilter.java 2008-01-29 15:23:02 UTC (rev 285)
+++ trunk/equanda-generate/src/main/java/org/equanda/domain/xml/DataFilter.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -26,6 +26,8 @@
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
+import com.thoughtworks.xstream.annotations.XStreamConverter;
+import org.equanda.domain.xml.aid.DataFilterConverter;
/**
* Implementation for data-filter
@@ -33,27 +35,31 @@
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
*/
@XStreamAlias( "data-filter" )
+@XStreamConverter( DataFilterConverter.class )
public class DataFilter
{
- @XStreamAsAttribute
private String name;
-
- @XStreamAlias( "" )
private String value;
-/*
- <!ELEMENT data-filter (#PCDATA)>
- <!ATTLIST data-filter
- name CDATA #REQUIRED>
-*/
-
public String getName()
{
return name;
}
+ public void setName( String name )
+ {
+ if ( "".equals( name ) ) name = null;
+ this.name = name;
+ }
+
public String getValue()
{
return value;
}
+
+ public void setValue( String value )
+ {
+ if ( "".equals( value ) ) value = null;
+ this.value = value;
+ }
}
Modified: trunk/equanda-generate/src/main/java/org/equanda/domain/xml/OverwriteDefault.java
===================================================================
--- trunk/equanda-generate/src/main/java/org/equanda/domain/xml/OverwriteDefault.java 2008-01-29 15:23:02 UTC (rev 285)
+++ trunk/equanda-generate/src/main/java/org/equanda/domain/xml/OverwriteDefault.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -35,13 +35,10 @@
* @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
*/
@XStreamAlias( "overwrite-default" )
-@XStreamConverter( OverwriteDefaultConverter.class)
+@XStreamConverter( OverwriteDefaultConverter.class )
public class OverwriteDefault
{
- @XStreamAsAttribute
private String field;
-
- @XStreamAlias( "" )
private String value;
public String getField()
@@ -51,6 +48,7 @@
public void setField( String field )
{
+ if ( "".equals( field ) ) field = null;
this.field = field;
}
@@ -61,6 +59,7 @@
public void setValue( String value )
{
+ if ( "".equals( value ) ) value = null;
this.value = value;
}
}
Added: trunk/equanda-generate/src/main/java/org/equanda/domain/xml/aid/DataFilterConverter.java
===================================================================
--- trunk/equanda-generate/src/main/java/org/equanda/domain/xml/aid/DataFilterConverter.java (rev 0)
+++ trunk/equanda-generate/src/main/java/org/equanda/domain/xml/aid/DataFilterConverter.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -0,0 +1,65 @@
+/**
+ * This file is part of the equanda project.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
+ * ANY KIND, either express or implied. See the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+package org.equanda.domain.xml.aid;
+
+import com.thoughtworks.xstream.converters.Converter;
+import com.thoughtworks.xstream.converters.MarshallingContext;
+import com.thoughtworks.xstream.converters.UnmarshallingContext;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import org.equanda.domain.xml.DataFilter;
+
+/**
+ * Converter for overwrite-default node.
+ *
+ * @author Joachim Van der Auwera <jo...@pr...>
+ */
+public class DataFilterConverter
+ implements Converter
+{
+ private static final String ATTRIBUTE_NAME = "name";
+
+ public void marshal( Object source, HierarchicalStreamWriter writer,
+ MarshallingContext context )
+ {
+ DataFilter value = (DataFilter) source;
+ if ( value.getName() != null ) writer.addAttribute( ATTRIBUTE_NAME, value.getName() );
+ if ( value.getValue() != null ) writer.setValue( value.getValue() );
+ }
+
+ public Object unmarshal( HierarchicalStreamReader reader,
+ UnmarshallingContext context )
+ {
+ DataFilter res = new DataFilter();
+ res.setName( reader.getAttribute( ATTRIBUTE_NAME ) );
+ res.setValue( reader.getValue() );
+ return res;
+ }
+
+ public boolean canConvert( Class type )
+ {
+ return type.equals( DataFilter.class );
+ }
+}
Modified: trunk/equanda-generate/src/main/java/org/equanda/domain/xml/aid/OverwriteDefaultConverter.java
===================================================================
--- trunk/equanda-generate/src/main/java/org/equanda/domain/xml/aid/OverwriteDefaultConverter.java 2008-01-29 15:23:02 UTC (rev 285)
+++ trunk/equanda-generate/src/main/java/org/equanda/domain/xml/aid/OverwriteDefaultConverter.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -45,8 +45,8 @@
MarshallingContext context )
{
OverwriteDefault value = (OverwriteDefault) source;
- writer.addAttribute( ATTRIBUTE_FIELD, value.getField() );
- writer.setValue( value.getValue() );
+ if ( value.getField() != null ) writer.addAttribute( ATTRIBUTE_FIELD, value.getField() );
+ if ( value.getValue() != null ) writer.setValue( value.getValue() );
}
public Object unmarshal( HierarchicalStreamReader reader,
Modified: trunk/equanda-generate/src/main/resources/equanda.dtd
===================================================================
--- trunk/equanda-generate/src/main/resources/equanda.dtd 2008-01-29 15:23:02 UTC (rev 285)
+++ trunk/equanda-generate/src/main/resources/equanda.dtd 2008-01-30 08:13:56 UTC (rev 286)
@@ -367,7 +367,14 @@
<!ELEMENT internal EMPTY>
<!ELEMENT link-name (#PCDATA)>
-<!ELEMENT constraints (unique|required|immutable|immutable-if|mutable-even-if|compare|value-when-null|value-when-zero)*>
+<!ELEMENT constraints (
+ (unique)?,
+ (required)?,
+ (immutable)?,
+ (immutable-if|mutable-even-if|compare)*,
+ (value-when-null)?,
+ (value-when-zero)?
+ )>
<!--
Unique fields are not allowed to be multiple, calculated, link.
Added: trunk/equanda-generate/src/test/java/org/equanda/domain/xml/CompareTest.java
===================================================================
--- trunk/equanda-generate/src/test/java/org/equanda/domain/xml/CompareTest.java (rev 0)
+++ trunk/equanda-generate/src/test/java/org/equanda/domain/xml/CompareTest.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -0,0 +1,70 @@
+/**
+ * This file is part of the equanda project.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
+ * ANY KIND, either express or implied. See the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+package org.equanda.domain.xml;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * test for compare class
+ *
+ * @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
+ */
+public class CompareTest
+ extends XStreamTestAdapter
+{
+ public void testParse1()
+ throws Exception
+ {
+ String test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE equanda SYSTEM \"equanda.dtd\">\n" +
+ "\n" +
+ "<compare test=\"!=\" value=\"xx\" left=\"left\" right=\"right\"/>";
+ XStream stream = getXStreamInstance();
+ Object res = stream.fromXML( test );
+ assertTrue( res instanceof Compare );
+ Compare compare = (Compare) res;
+ assertEquals( "!=", compare.getTest() );
+ assertEquals( "xx", compare.getValue() );
+ assertEquals( "left", compare.getLeft() );
+ assertEquals( "right", compare.getRight() );
+ }
+
+ public void testParse2()
+ throws Exception
+ {
+ String test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE equanda SYSTEM \"equanda.dtd\">\n" +
+ "\n" +
+ "<compare/>";
+ XStream stream = getXStreamInstance();
+ Object res = stream.fromXML( test );
+ assertTrue( res instanceof Compare );
+ Compare compare = (Compare) res;
+ assertNull( "!=", compare.getTest() );
+ assertNull( "xx", compare.getValue() );
+ assertNull( "left", compare.getLeft() );
+ assertNull( "right", compare.getRight() );
+ }
+}
Added: trunk/equanda-generate/src/test/java/org/equanda/domain/xml/ConstraintsTest.java
===================================================================
--- trunk/equanda-generate/src/test/java/org/equanda/domain/xml/ConstraintsTest.java (rev 0)
+++ trunk/equanda-generate/src/test/java/org/equanda/domain/xml/ConstraintsTest.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -0,0 +1,95 @@
+/**
+ * This file is part of the equanda project.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
+ * ANY KIND, either express or implied. See the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+package org.equanda.domain.xml;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * test for constraints class
+ *
+ * @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
+ */
+public class ConstraintsTest
+ extends XStreamTestAdapter
+{
+ public void testParse1()
+ throws Exception
+ {
+ String test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE equanda SYSTEM \"equanda.dtd\">\n" +
+ "\n" +
+ "<constraints>" +
+ " <unique/>" +
+ " <required/>" +
+ " <immutable/>" +
+ " <immutable-if />" +
+ " <immutable-if />" +
+ " <mutable-even-if />" +
+ " <mutable-even-if />" +
+ " <compare test=\"!=\"/>" +
+ " <compare test=\">=\"/>" +
+ " <compare test=\"<=\"/>" +
+ "</constraints>";
+ XStream stream = getXStreamInstance();
+ Object res = stream.fromXML( test );
+ assertTrue( res instanceof Constraints );
+ Constraints constraints = (Constraints) res;
+ assertTrue( constraints.isUnique() );
+ assertTrue( constraints.isRequired() );
+ assertTrue( constraints.isImmutable() );
+ assertNotNull( constraints.getImmutableIf() );
+ assertEquals( 2, constraints.getImmutableIf().size() );
+ assertNotNull( constraints.getMutableEvenIf() );
+ assertEquals( 2, constraints.getMutableEvenIf().size() );
+ assertNotNull( constraints.getCompare() );
+ assertEquals( 3, constraints.getCompare().size() );
+ assertNull( constraints.getValueWhenNull() );
+ assertNull( constraints.getValueWhenZero() );
+ }
+
+ public void testParse2()
+ throws Exception
+ {
+ String test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE equanda SYSTEM \"equanda.dtd\">\n" +
+ "\n" +
+ "<constraints>" +
+ " <value-when-null/>" +
+ " <value-when-zero/>" +
+ "</constraints>";
+ XStream stream = getXStreamInstance();
+ Object res = stream.fromXML( test );
+ assertTrue( res instanceof Constraints );
+ Constraints constraints = (Constraints) res;
+ assertFalse( constraints.isUnique() );
+ assertFalse( constraints.isRequired() );
+ assertFalse( constraints.isImmutable() );
+ assertNull( constraints.getImmutableIf() );
+ assertNull( constraints.getMutableEvenIf() );
+ assertNull( constraints.getCompare() );
+ assertNotNull( constraints.getValueWhenNull() );
+ assertNotNull( constraints.getValueWhenZero() );
+ }
+}
Added: trunk/equanda-generate/src/test/java/org/equanda/domain/xml/DataFilterTest.java
===================================================================
--- trunk/equanda-generate/src/test/java/org/equanda/domain/xml/DataFilterTest.java (rev 0)
+++ trunk/equanda-generate/src/test/java/org/equanda/domain/xml/DataFilterTest.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -0,0 +1,66 @@
+/**
+ * This file is part of the equanda project.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
+ * ANY KIND, either express or implied. See the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+package org.equanda.domain.xml;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * test for data-filter class
+ *
+ * @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
+ */
+public class DataFilterTest
+ extends XStreamTestAdapter
+{
+ public void testParse1()
+ throws Exception
+ {
+ String test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE equanda SYSTEM \"equanda.dtd\">\n" +
+ "\n" +
+ "<data-filter name=\"filtername\">filter-value</data-filter>";
+ XStream stream = getXStreamInstance();
+ Object res = stream.fromXML( test );
+ assertTrue( res instanceof DataFilter );
+ DataFilter datafilter = (DataFilter) res;
+ assertEquals( "filtername", datafilter.getName() );
+ assertEquals( "filter-value", datafilter.getValue() );
+ }
+
+ public void testParse2()
+ throws Exception
+ {
+ String test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE equanda SYSTEM \"equanda.dtd\">\n" +
+ "\n" +
+ "<data-filter/>";
+ XStream stream = getXStreamInstance();
+ Object res = stream.fromXML( test );
+ assertTrue( res instanceof DataFilter );
+ DataFilter datafilter = (DataFilter) res;
+ assertNull( datafilter.getName() );
+ assertNull( datafilter.getValue() );
+ }
+}
Added: trunk/equanda-generate/src/test/java/org/equanda/domain/xml/OverwriteDefaultTest.java
===================================================================
--- trunk/equanda-generate/src/test/java/org/equanda/domain/xml/OverwriteDefaultTest.java (rev 0)
+++ trunk/equanda-generate/src/test/java/org/equanda/domain/xml/OverwriteDefaultTest.java 2008-01-30 08:13:56 UTC (rev 286)
@@ -0,0 +1,66 @@
+/**
+ * This file is part of the equanda project.
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
+ * ANY KIND, either express or implied. See the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+package org.equanda.domain.xml;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * test for overwrite-default class
+ *
+ * @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a>
+ */
+public class OverwriteDefaultTest
+ extends XStreamTestAdapter
+{
+ public void testParse1()
+ throws Exception
+ {
+ String test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE equanda SYSTEM \"equanda.dtd\">\n" +
+ "\n" +
+ "<overwrite-default field=\"xx\">value</overwrite-default>";
+ XStream stream = getXStreamInstance();
+ Object res = stream.fromXML( test );
+ assertTrue( res instanceof OverwriteDefault );
+ OverwriteDefault overwritedefault = (OverwriteDefault) res;
+ assertEquals( "value", overwritedefault.getValue() );
+ assertEquals( "xx", overwritedefault.getField() );
+ }
+
+ public void testParse2()
+ throws Exception
+ {
+ String test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE equanda SYSTEM \"equanda.dtd\">\n" +
+ "\n" +
+ "<overwrite-default/>";
+ XStream stream = getXStreamInstance();
+ Object res = stream.fromXML( test );
+ assertTrue( res instanceof OverwriteDefault );
+ OverwriteDefault overwriteDefault = (OverwriteDefault) res;
+ assertNull( overwriteDefault.getValue() );
+ assertNull( overwriteDefault.getField() );
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|