package com.fasterxml.jackson.databind.introspect;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;

/**
 * Unit tests verifying handling of potential and actual
 * conflicts, regarding property handling.
 */
public class TestPropertyRename extends BaseMapTest
{
    static class Bean323WithIgnore { 
        @JsonIgnore
        private int a;

        public Bean323WithIgnore(@JsonProperty("a") final int a ) {
            this.a = a;
        }

        @JsonProperty("b")
        private int getA () {
            return a;
        }
    }    

    static class Bean323WithExplicitCleave1 { 
        @JsonProperty("a")
        private int a;

        public Bean323WithExplicitCleave1(@JsonProperty("a") final int a ) {
            this.a = a;
        }

        @JsonProperty("b")
        private int getA () {
            return a;
        }
    } 

    @JsonPropertyOrder({ "a","b" })
    static class Bean323WithExplicitCleave2 { 
        @JsonProperty("b")
        private int a;

        public Bean323WithExplicitCleave2(@JsonProperty("a") final int a ) {
            this.a = a;
        }

        @JsonProperty("b")
        private int getA () {
            return a;
        }
    }    
   
    /*
    /**********************************************************
    /* Test methods
    /**********************************************************
     */

    public void testCreatorPropRenameWithIgnore() throws Exception
    {
        Bean323WithIgnore input = new Bean323WithIgnore(7);
        assertEquals("{\"b\":7}", objectWriter().writeValueAsString(input));
    }

    public void testCreatorPropRenameWithCleave() throws Exception
    {
        assertEquals("{\"a\":7,\"b\":7}", objectWriter().writeValueAsString(new Bean323WithExplicitCleave1(7)));
        assertEquals("{\"b\":7}", objectWriter().writeValueAsString(new Bean323WithExplicitCleave2(7)));
    }
}

@@ -577,16 +577,52 @@
  %7D    %0A%0A
+    @JsonPropertyOrder(%7B %22a%22,%22b%22 %7D)%0A
     stat
@@ -1756,33 +1756,43 @@
 a%5C%22:7,%5C%22b%5C%22:7%7D%22,
- 
+%0A        %09%09
 objectWriter().w
@@ -1842,24 +1842,110 @@
 eave1(7)));%0A
+        // note: 'a' NOT included as only ctor property found for it, no getter/field%0A
         asse

Add explicit ordering for test to resolve part of #480