Skip to content

Commit

Permalink
Create failing test for #441
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 10, 2020
1 parent 8327852 commit b72e959
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.fasterxml.jackson.dataformat.xml.failing;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;

// for [dataformat-xml#441]
public class JsonNodeBasicSer441Test extends XmlTestBase
{
final private ObjectMapper XML_MAPPER = newMapper();

public void testSimpleNode() throws Exception
{
ObjectNode xml = XML_MAPPER.createObjectNode();
ObjectNode root = xml.putObject("root");
root.put("id", 13);
root.put("enabled", true);
//System.err.println("XML/object: "+XML_MAPPER.writeValueAsString(xml));
assertEquals("<root><id>13</id><enabled>true</enabled></root>",
XML_MAPPER.writeValueAsString(xml));
}

public void testArrayNode() throws Exception
{
ObjectNode xml = XML_MAPPER.createObjectNode();
ObjectNode root = xml.putObject("root");
ArrayNode arr = root.putArray("array");
arr.add("first");
ObjectNode second = arr.addObject();
second.put("value", 137);

//System.err.println("XML/array: "+XML_MAPPER.writeValueAsString(xml));
assertEquals("<root><array>first</array><array><value>137</value></array></root>",
XML_MAPPER.writeValueAsString(xml));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fasterxml.jackson.dataformat.xml.deser;
package com.fasterxml.jackson.dataformat.xml.node;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fasterxml.jackson.dataformat.xml.deser;
package com.fasterxml.jackson.dataformat.xml.node;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
Expand Down

0 comments on commit b72e959

Please sign in to comment.