package com.fasterxml.jackson.dataformat.xml;

import java.io.IOException;

import com.fasterxml.jackson.dataformat.xml.annotation.*;

public class TestTextValue extends XmlTestBase
{
    /*
    /**********************************************************
    /* Helper types
    /**********************************************************
     */

	static class Simple
	{
		@JacksonXmlProperty(isAttribute=true)
		// same as: @javax.xml.bind.annotation.XmlAttribute
		public int a = 13;

		@JacksonXmlText
		// about same as: @javax.xml.bind.annotation.XmlValue
		public String text = "something";
	}
	
    /*
    /**********************************************************
    /* Unit tests
    /**********************************************************
     */

    public void testSerializeAsText() throws IOException
    {
    	XmlMapper mapper = new XmlMapper();
    	String xml = mapper.writeValueAsString(new Simple());
    	assertEquals("<Simple a=\"13\">something</Simple>", xml);
    }

    public void testDeserializeAsText() throws IOException
    {
    	XmlMapper mapper = new XmlMapper();
    	Simple result = mapper.readValue("<Simple a='99'>else</Simple>",
    			Simple.class);
    	assertEquals(99, result.a);
    	assertEquals("else", result.text);
    }
    
    /* // Uncomment to see how JAXB works here:
    public void testJAXB() throws Exception
    {
        java.io.StringWriter sw = new java.io.StringWriter();
        javax.xml.bind.JAXB.marshal(new Simple(), sw);
        System.out.println("JAXB -> "+sw);
    }
    */
}

@@ -69,16 +69,70 @@
 ption;%0A%0A
+import com.fasterxml.jackson.annotation.JsonProperty;%0A
 import c
@@ -181,16 +181,16 @@
 tion.*;%0A
-
 %0Apublic 
@@ -650,20 +650,472 @@
 %22;%0A%09%7D%0A%09%0A
-    
+%09// Issue-24:%0A%0A%09static class Main %7B%0A%09%09@JsonProperty(%22com.test.stack%22) public Stack stack;%0A%09%7D%0A%09static class Stack %7B%0A%09%09public String name;%0A%0A%09%09@JsonProperty(%22com.test.stack.slot%22)%0A%09%09public Slot slot;%0A%09%7D%0A%09static class Slot %7B%0A%09%09@JsonProperty(%22name%22)%0A%09%09public String name;%0A%0A%09%09@JsonProperty(%22id%22)%0A%09%09public String id;%0A%0A%09%09@JsonProperty(%22height%22)%0A%09%09public String height;%0A%0A%09%09@JsonProperty(%22width%22)%0A%09%09public String width;%0A%0A%09%09@JacksonXmlText%0A%09%09public String value;%0A%09%7D%0A%09
 /*%0A    /
@@ -1728,16 +1728,16 @@
 ult.a);%0A
-
     %09ass
@@ -1779,16 +1779,602 @@
  %7D%0A    %0A
+    public void testIssue24() throws Exception%0A    %7B%0A    %09final String TEXT = %22+/null/this is a long string%22;%0A    %09final String XML =%0A    %09%09%09%22%3Cmain%3E%5Cn%22%0A    %09%09%09+%22%3Ccom.test.stack name='stack1'%3E%5Cn%22%0A    %09%09%09+%22%3Ccom.test.stack.slot height='0' id='0' name='slot0' width='0'%3E%22%0A    %09%09%09+TEXT%0A    %09%09%09+%22%3C/com.test.stack.slot%3E%5Cn%22%0A    %09%09%09+%22%3C/com.test.stack%3E%5Cn%22%0A    %09%09%09+%22%3C/main%3E%22;%0A    %09XmlMapper mapper = new XmlMapper();%0A    %09Main main = mapper.readValue(XML, Main.class);%0A    %09assertNotNull(main.stack);%0A    %09assertNotNull(main.stack.slot);%0A    %09assertEquals(TEXT, main.stack.slot.value);%0A    %7D%0A    %0A
     /* /

Add a unit test for Issue-24