@@ -0,0 +1,2466 @@
+package com.readlearncode.hashtag100DaysOfJavaEE8;%0A%0Aimport org.junit.Test;%0A%0Aimport javax.json.bind.JsonbBuilder;%0Aimport javax.json.bind.JsonbConfig;%0Aimport javax.json.bind.annotation.JsonbPropertyOrder;%0Aimport javax.json.bind.config.PropertyOrderStrategy;%0A%0Aimport static org.assertj.core.api.Java6Assertions.assertThat;%0A%0A/**%0A * Source code github.com/readlearncode%0A *%0A * @author Alex Theedom www.readlearncode.com%0A * @version 1.0%0A */%0Apublic class PropertyOrderStrategyTest %7B%0A%0A    @JsonbPropertyOrder(value = %7B%22authorName%22, %22bookPrice%22, %22bookTitle%22%7D)%0A    public class Book %7B%0A        public String bookTitle = %22Fun with JSON Binding%22;%0A        public String authorName = %22Alex Theedom%22;%0A        public Float bookPrice = 19.99f;%0A    %7D%0A%0A    @Test%0A    public void givenPropertyOrderStrategy_shouldSerialise() %7B%0A%0A        JsonbConfig jsonbConfig = new JsonbConfig()%0A                .withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE);%0A%0A        String json = JsonbBuilder.create(jsonbConfig).toJson(new Book());%0A%0A        assertThat(json).isEqualTo(%22%7B%5C%22authorName%5C%22:%5C%22Alex Theedom%5C%22,%5C%22bookPrice%5C%22:19.99,%5C%22bookTitle%5C%22:%5C%22Fun with JSON Binding%5C%22%7D%22);%0A%0A    %7D%0A%0A    /*%0A%0A%09%09JSON Binding allows fine grain control over the order of the%0A%09%09JSON properties. Given an instance of the Book class and the JSON%0A%09%09Binding code, which JSON document is produced?%0A%0A%09%09// Book class%0A        @JsonbPropertyOrder(value = %7B%22authorName%22, %22bookPrice%22, %22bookTitle%22%7D)%0A        public class Book %7B%0A            public String bookTitle = %22Fun with JSON Binding%22;%0A            public String authorName = %22Alex Theedom%22;%0A            public Float bookPrice = 19.99f;%0A        %7D%0A%0A%09%09// JSON binding code%0A        JsonbConfig jsonbConfig = new JsonbConfig()%0A                .withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE);%0A%0A        String json = JsonbBuilder.create(jsonbConfig).toJson(new Book());%0A%0A%09%09// Which JSON document is produced by this code?%0A%09 1. %7B%0A          %22bookTitle%22: %22Fun with JSON Binding%22,%0A          %22bookPrice%22: 19.99,%0A          %22authorName%22: %22Alex Theedom%22%0A        %7D%0A%0A%09 2. %7B%0A          %22authorName%22: %22Alex Theedom%22,%0A          %22bookPrice%22: 19.99,%0A          %22bookTitle%22: %22Fun with JSON Binding%22%0A        %7D%0A%0A%09 3. %7B%0A          %22bookTitle%22: %22Fun with JSON Binding%22,%0A          %22authorName%22: %22Alex Theedom%22,%0A          %22bookPrice%22: 19.99%0A        %7D%0A%0A%09 4. %7B%0A          %22bookPrice%22: 19.99,%0A          %22bookTitle%22: %22Fun with JSON Binding%22,%0A          %22authorName%22: %22Alex Theedom%22%0A        %7D%0A%0A%0A%0A     */%0A%0A%7D

add property order strategy