package br.com.tdsis.lambda.forest.json;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import br.com.tdsis.lambda.forest.http.ResponseBodySerializerStrategy;
import br.com.tdsis.lambda.forest.http.exception.HttpException;
import br.com.tdsis.lambda.forest.http.exception.InternalServerErrorException;

/**
 * The JSON response body serializer strategy
 * 
 * @author nmelo
 * @version 1.0.0
 * @since 1.0.0
 */
public class JsonResponseBodySerializerStrategy implements ResponseBodySerializerStrategy {
        
    @Override
    public String serialize(Object entity) throws HttpException {
        String json = null;
        
        try {
            
            ObjectMapper mapper = new ObjectMapper();
            mapper.setSerializationInclusion(Include.NON_NULL);
            json = mapper.writeValueAsString(entity);   
            
        } catch (JsonProcessingException e) {           
            throw new InternalServerErrorException(e.getMessage(), e);      
        }
        
        return json;
    }

}

@@ -206,16 +206,76 @@
 tMapper;
+%0Aimport com.fasterxml.jackson.databind.SerializationFeature;
 %0A%0Aimport
@@ -890,16 +890,28 @@
 apper();
+            
 %0A       
@@ -967,16 +967,108 @@
 _NULL);%0A
+            mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);%0A            %0A
         

Set FAIL_ON_EMPTY_BEANS to false when serializing responses. Fixes gh-6