// Path: stardao-core/src/main/java/io/stardog/stardao/jackson/JsonHelper.java
// public class JsonHelper {
//     public static ObjectMapper MAPPER = new ObjectMapper()
//             .configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true)
//             .configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true)
//             .registerModule(new JavaTimeModule())
//             .registerModule(new Jdk8Module());
// 
//     /**
//      * Create an object, given a JSON string and a class.
//      * @param json  JSON string
//      * @param klazz class of object to create
//      * @param <T>   type of object to create
//      * @return  object
//      */
//     public static <T> T obj(String json, Class<T> klazz) {
//         try {
//             return MAPPER.readValue(json, klazz);
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     public static <T> T object(String json, Class<T> klazz) {
//         return obj(json, klazz);
//     }
// 
//     /**
//      * Create an Update object, given the class of the update type
//      * @param json  JSON string
//      * @param klazz class of the update type
//      * @param <T>   update type
//      * @return
//      */
//     public static <T> Update<T> update(String json, Class<T> klazz) {
//         try {
//             JavaType type = MAPPER.getTypeFactory().constructParametricType(Update.class, klazz);
//             return MAPPER.readValue(json, type);
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     /**
//      * Turn an object into JSON.
//      * @param object    object
//      * @return  JSON string of object
//      */
//     public static String json(Object object) {
//         try {
//             return MAPPER.writeValueAsString(object);
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// }


import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import io.stardog.stardao.jackson.JsonHelper;
import org.bson.types.ObjectId;
import org.junit.Test;
import java.lang.reflect.Method;
import java.util.Optional;
import static org.junit.Assert.*;
    }

    @Test
    public void testGeneratedOf() throws Exception {
        TestUser user = TestUser.builder().id(new ObjectId()).name("Bob Jones").age(42).email("example@example.com").build();
        PartialTestUser partial = PartialTestUser.of(user);
        assertEquals("Bob Jones", partial.getName().get());
        assertEquals(new Integer(42), partial.getAge().get());
        assertEquals("example@example.com", partial.getEmail().get());
    }

    @Test
    public void testJackson() throws Exception {
        ObjectMapper mapper = new ObjectMapper()
                .registerModule(new Jdk8Module());

        PartialTestUser user = PartialTestUser.builder().age(Optional.of(36)).build();
        String json = mapper.writeValueAsString(user);
        assertEquals("{\"age\":36}", json);

        user = mapper.readValue("{\"age\":36,\"email\":\"example@example.com\"}", PartialTestUser.class);
        assertEquals(new Integer(36), user.getAge().get());
        assertEquals("example@example.com", user.getEmail().get());

        user = mapper.readValue("{\"name\":\"Bob\"}", PartialTestUser.class);
        assertEquals("Bob", user.getName().get());
    }

    @Test
    public void testJsonHelper() throws Exception {
// Path: stardao-core/src/main/java/io/stardog/stardao/jackson/JsonHelper.java
// public class JsonHelper {
//     public static ObjectMapper MAPPER = new ObjectMapper()
//             .configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true)
//             .configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true)
//             .registerModule(new JavaTimeModule())
//             .registerModule(new Jdk8Module());
// 
//     /**
//      * Create an object, given a JSON string and a class.
//      * @param json  JSON string
//      * @param klazz class of object to create
//      * @param <T>   type of object to create
//      * @return  object
//      */
//     public static <T> T obj(String json, Class<T> klazz) {
//         try {
//             return MAPPER.readValue(json, klazz);
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     public static <T> T object(String json, Class<T> klazz) {
//         return obj(json, klazz);
//     }
// 
//     /**
//      * Create an Update object, given the class of the update type
//      * @param json  JSON string
//      * @param klazz class of the update type
//      * @param <T>   update type
//      * @return
//      */
//     public static <T> Update<T> update(String json, Class<T> klazz) {
//         try {
//             JavaType type = MAPPER.getTypeFactory().constructParametricType(Update.class, klazz);
//             return MAPPER.readValue(json, type);
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     /**
//      * Turn an object into JSON.
//      * @param object    object
//      * @return  JSON string of object
//      */
//     public static String json(Object object) {
//         try {
//             return MAPPER.writeValueAsString(object);
//         } catch (Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
// }


// Path: stardao-auto/src/test/java/io/stardog/stardao/auto/processor/AutoPartialProcessorTest.java
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import io.stardog.stardao.jackson.JsonHelper;
import org.bson.types.ObjectId;
import org.junit.Test;
import java.lang.reflect.Method;
import java.util.Optional;
import static org.junit.Assert.*;

    }

    @Test
    public void testGeneratedOf() throws Exception {
        TestUser user = TestUser.builder().id(new ObjectId()).name("Bob Jones").age(42).email("example@example.com").build();
        PartialTestUser partial = PartialTestUser.of(user);
        assertEquals("Bob Jones", partial.getName().get());
        assertEquals(new Integer(42), partial.getAge().get());
        assertEquals("example@example.com", partial.getEmail().get());
    }

    @Test
    public void testJackson() throws Exception {
        ObjectMapper mapper = new ObjectMapper()
                .registerModule(new Jdk8Module());

        PartialTestUser user = PartialTestUser.builder().age(Optional.of(36)).build();
        String json = mapper.writeValueAsString(user);
        assertEquals("{\"age\":36}", json);

        user = mapper.readValue("{\"age\":36,\"email\":\"example@example.com\"}", PartialTestUser.class);
        assertEquals(new Integer(36), user.getAge().get());
        assertEquals("example@example.com", user.getEmail().get());

        user = mapper.readValue("{\"name\":\"Bob\"}", PartialTestUser.class);
        assertEquals("Bob", user.getName().get());
    }

    @Test
    public void testJsonHelper() throws Exception {
        PartialTestUser user = JsonHelper.object("{age:36}", PartialTestUser.class);