<commit_before>/*
 * Copyright (c) 2002-2014 Nu Echo Inc. All rights reserved.
 */

package com.fasterxml.jackson.dataformat.xml.failing;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import java.util.*;

import org.junit.*;

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

/**
 * @author Nu Echo Inc.
 */
public class Issue97Test extends XmlTestBase
{
    @JsonTypeInfo(property = "type", use = Id.NAME)
    public static abstract class Foo {
        @JacksonXmlProperty(isAttribute = true)
        public String data;
    }

    @JsonTypeName("good")
    public static class FooGood extends Foo {
        public String bar;
    }

    @JsonTypeName("bad")
    public static class FooBad extends Foo {
        @JacksonXmlElementWrapper(useWrapping = false)
        public List<String> bar;
    }

    @Test
    public void testGood() throws Exception {
        XmlMapper mapper = new XmlMapper();
        mapper.registerSubtypes(FooGood.class);

        String xml = "<Foo type=\"good\" data=\"dummy\"><bar>FOOBAR</bar></Foo>";
        Foo fooRead = mapper.readValue(xml, Foo.class);<commit_msg>fix #97<commit_after>package com.fasterxml.jackson.dataformat.xml.failing;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import java.util.*;

import org.junit.*;

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

/**
 * @author pgelinas
 */
public class Issue97Test extends XmlTestBase
{
    @JsonTypeInfo(property = "type", use = Id.NAME)
    public static abstract class Foo {
        @JacksonXmlProperty(isAttribute = true)
        public String data;
    }

    @JsonTypeName("good")
    public static class FooGood extends Foo {
        public String bar;
    }

    @JsonTypeName("bad")
    public static class FooBad extends Foo {
        @JacksonXmlElementWrapper(useWrapping = false)
        public List<String> bar;
    }

    @Test
    public void testGood() throws Exception {
        XmlMapper mapper = new XmlMapper();
        mapper.registerSubtypes(FooGood.class);

        String xml = "<Foo type=\"good\" data=\"dummy\"><bar>FOOBAR</bar></Foo>";
        Foo fooRead = mapper.readValue(xml, Foo.class);
{'fraction_non_alphanumeric': 0.12113918973124749, 'fraction_numerical': 0.005615724027276374, 'mean_word_length': 3.3373913043478263, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6963373', 'n_tokens_mistral': 782, 'n_tokens_neox': 707, 'n_words': 178}