@@ -0,0 +1,1629 @@
+package com.readlearncode.hashtag100DaysOfJavaEE8;%0A%0Aimport org.junit.Test;%0A%0Aimport javax.json.bind.JsonbBuilder;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Optional;%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 DefaultNullTreatmentTest %7B%0A%0A    public class Book %7B%0A        public String title = null;%0A        public List%3CString%3E authors = new ArrayList%3CString%3E() %7B%7B%0A            add(%22Alex Theedom%22);%0A            add(null);%0A        %7D%7D;%0A        public Optional%3CFloat%3E price = Optional.empty();%0A    %7D%0A%0A    @Test%0A    public void givenPropertiesAreNull_shouldSerialise() %7B%0A        String json = JsonbBuilder.create().toJson(new DefaultNullTreatmentTest.Book());%0A        assertThat(json).isEqualTo(%22%7B%5C%22authors%5C%22:%5B%5C%22Alex Theedom%5C%22,null%5D%7D%22);%0A    %7D%0A%0A    /*%0A%0A%0A%0A%09%09How does JSON Bindings treat nulls and empty Optionals?%0A%09%09Given an instance of the Book class, which JSON document%0A%09%09is produced?%0A%0A%09%09// Book class%0A%09%09public class Book %7B%0A%09%09%09public String title = null;%0A%09%09%09public List%3CString%3E authors = new ArrayList%3CString%3E() %7B%7B%0A%09%09%09%09add(%22Alex Theedom%22);%0A%09%09%09%09add(null);%0A%09%09%09%7D%7D;%0A%09%09%09public Optional%3CFloat%3E price = Optional.empty();%0A%09%09%7D%0A%0A%09%09// Which JSON document is produced?%0A%09 1. %7B%0A%09%09  %22authors%22: %5B%0A%09%09%09%22Alex Theedom%22,%0A%09%09%09null%0A%09%09  %5D,%0A%09%09  %22title%22: null%0A%09%09%7D%0A%0A%09 2. %7B%0A%09%09  %22authors%22: %5B%0A%09%09%09%22Alex Theedom%22,%0A%09%09%09null%0A%09%09  %5D%0A%09%09%7D%0A%0A%09 3. %7B%0A%09%09  %22authors%22: %5B%0A%09%09%09%22Alex Theedom%22,%0A%09%09%09null%0A%09%09  %5D,%0A%09%09  %22price%22: null,%0A%09%09  %22title%22: null%0A%09%09%7D%0A%0A%09 4. %7B%0A%09%09  %22authors%22: %5B%0A%09%09%09%22Alex Theedom%22%0A%09%09  %5D%0A%09%09%7D%0A%0A     */%0A%0A%7D

add 100DaysOfJavaEE8 for JSON Binding default treatment of nulls