@@ -0,0 +1,1701 @@
+package com.fasterxml.jackson.databind.jsontype.ext;%0A%0Aimport com.fasterxml.jackson.annotation.*;%0A%0Aimport com.fasterxml.jackson.databind.*;%0A%0Apublic class ExternalTypeIdWithUnwrapped2039Test extends BaseMapTest%0A%7B%0A    static class MainType2039 %7B%0A        public String text;%0A%0A        @JsonUnwrapped public Wrapped2039 wrapped;%0A%0A        @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = %22subtype%22)%0A        @JsonSubTypes(%7B @JsonSubTypes.Type(value = SubA2039.class, name = %22SubA%22) %7D)%0A        public SubType2039 sub;%0A%0A        public void setSub(SubType2039 s) %7B%0A            sub = s;%0A        %7D%0A%0A        public void setWrapped(Wrapped2039 w) %7B%0A            wrapped = w;%0A        %7D%0A    %7D%0A%0A    static class Wrapped2039 %7B%0A        public String wrapped;%0A    %7D%0A%0A    public static class SubType2039 %7B %7D%0A%0A    public static class SubA2039 extends SubType2039 %7B%0A        @JsonProperty public boolean bool;%0A    %7D%0A    %0A    public void testExternalWithUnwrapped2039() throws Exception%0A    %7B%0A        final ObjectMapper mapper = newObjectMapper();%0A%0A        final String json = aposToQuotes(%22%7B%5Cn%22%0A                +%22'text': 'this is A',%5Cn%22%0A                +%22'wrapped': 'yes',%5Cn%22%0A                +%22'subtype': 'SubA',%5Cn%22%0A                +%22'sub': %7B%5Cn%22%0A                +%22  'bool': true%5Cn%22%0A                +%22%7D%5Cn%22%0A                +%22%7D%22);%0A        final MainType2039 main = mapper.readValue(json, MainType2039.class);%0A%0A        assertEquals(%22this is A%22, main.text);%0A        assertEquals(%22yes%22, main.wrapped.wrapped);%0A%0A        assertNotNull(main.sub);%0A        assertEquals(SubA2039.class, main.sub.getClass()); // %3C- fails here%0A        assertEquals(true, ((SubA2039) main.sub).bool);%0A    %7D%0A%7D%0A

Add failing test for #2039