@@ -0,0 +1,2023 @@
+package com.readlearncode.hashtag100DaysOfJavaEE8;%0A%0Aimport org.junit.Test;%0A%0Aimport javax.json.bind.JsonbBuilder;%0Aimport javax.json.bind.JsonbConfig;%0Aimport javax.json.bind.config.PropertyNamingStrategy;%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 PropertyNamingStrategyTest %7B%0A%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 givenPropertyNamingStrategy_shouldSerialise() %7B%0A%0A        JsonbConfig jsonbConfig = new JsonbConfig()%0A                .withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_DASHES);%0A%0A        String json = JsonbBuilder.create(jsonbConfig).toJson(new Book());%0A%0A        assertThat(json).isEqualTo(%22%7B%5C%22author-name%5C%22:%5C%22Alex Theedom%5C%22,%5C%22book-price%5C%22:19.99,%5C%22book-title%5C%22:%5C%22Fun with JSON Binding%5C%22%7D%22);%0A%0A    %7D%0A%0A    /*%0A%0A%0A%0A%0A%0A%0A%09%09JSON Binding allows fine grain control over the format of the%0A%09%09JSON document. 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%09%09public class Book %7B%0A%09%09%09public String bookTitle = %22Fun with JSON Binding%22;%0A%09%09%09public String authorName = %22Alex Theedom%22;%0A%09%09%7D%0A%0A%09%09// JSON binding code%0A%09%09JsonbConfig jsonbConfig = new JsonbConfig()%0A%09%09%09%09.withPropertyNamingStrategy(%0A%09%09%09%09%09%09PropertyNamingStrategy.LOWER_CASE_WITH_DASHES);%0A%0A%09%09String json = JsonbBuilder.create(jsonbConfig).toJson(new Book());%0A%0A%09%09// Which JSON document is produced by this code?%0A%09 1. %7B%0A%09%09  %22author-name%22: %22Alex Theedom%22,%0A%09%09  %22book-title%22: %22Fun with JSON Binding%22%0A%09%09%7D%0A%0A%09 2. %7B%0A%09%09  %22book-title%22: %22Fun with JSON Binding%22,%0A%09%09  %22author-name%22: %22Alex Theedom%22%0A%09%09%7D%0A%0A%09 3. %7B%0A%09%09  %22author-Name%22: %22Alex Theedom%22,%0A%09%09  %22book-Title%22: %22Fun with JSON Binding%22%0A%09%09%7D%0A%0A%09 4. %7B%0A%09%09  %22authorName%22: %22Alex Theedom%22,%0A%09%09  %22bookTitle%22: %22Fun with JSON Binding%22%0A%09%09%7D%0A     */%0A%0A%7D

Add 100DaysOfJavaEE8 JSON-B