// Path: stardao-core/src/test/java/io/stardog/stardao/core/TestModel.java
// @AutoValue
// @JsonInclude(JsonInclude.Include.NON_NULL)
// @JsonDeserialize(builder=AutoValue_TestModel.Builder.class)
// public abstract class TestModel {
//     @Nullable
//     @Id
//     public abstract UUID getId();
// 
//     @Nullable
//     @Updatable
//     @NotEmpty(groups = Required.class)
//     public abstract String getName();
// 
//     @Nullable
//     @Updatable
//     @Email
//     @Pattern(regexp=".+@.+\\..+", message = "invalid email")
//     public abstract String getEmail();
// 
//     @Nullable
//     @Updatable
//     @NotEmpty(groups = Required.class)
//     public abstract String getCountry();
// 
//     @Nullable
//     @Updatable
//     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
//     public abstract LocalDate getBirthday();
// 
//     @Nullable
//     @Updatable
//     public abstract Boolean getActive();
// 
//     @Nullable
//     @CreatedBy
//     public abstract UUID getCreateId();
// 
//     @Nullable
//     @CreatedAt
//     public abstract Instant getCreateAt();
// 
//     @Nullable
//     @UpdatedBy
//     public abstract UUID getUpdateId();
// 
//     @Nullable
//     @UpdatedAt
//     public abstract Instant getUpdateAt();
// 
//     @Nullable
//     public abstract Instant getLoginAt();
// 
//     public Instant getLoginAt(long millis) {
//         return Instant.ofEpochMilli(millis);
//     }
// 
//     public abstract Builder toBuilder();
//     public static TestModel.Builder builder() {
//         return new AutoValue_TestModel.Builder();
//     }
// 
//     @AutoValue.Builder
//     @JsonPOJOBuilder(withPrefix = "")
//     public abstract static class Builder {
//         public abstract Builder id(UUID id);
//         public abstract Builder name(String name);
//         public abstract Builder email(String email);
//         public abstract Builder country(String state);
//         public abstract Builder birthday(LocalDate state);
//         public abstract Builder active(Boolean active);
//         public abstract Builder createAt(Instant at);
//         public abstract Builder createId(UUID id);
//         public abstract Builder updateAt(Instant at);
//         public abstract Builder updateId(UUID id);
//         public abstract Builder loginAt(Instant at);
//         public abstract TestModel build();
//     }
// }
// 
// Path: stardao-core/src/main/java/io/stardog/stardao/core/Update.java
// @AutoValue
// @JsonDeserialize(using = UpdateDeserializer.class)
// @JsonSerialize(using = UpdateSerializer.class)
// public abstract class Update<P> {
//     public abstract P getPartial();
//     public abstract Set<String> getSetFields();
//     public abstract Set<String> getRemoveFields();
// 
//     public static <T> Update<T> of(T setObject, Set<String> setFields) {
//         return new AutoValue_Update<>(setObject, setFields, ImmutableSet.of());
//     }
// 
//     public static <T> Update<T> of(T setObject, Set<String> setFields, Set<String> removeFields) {
//         return new AutoValue_Update<>(setObject, setFields, removeFields);
//     }
// 
//     public boolean isEmpty() {
//         return getSetFields().isEmpty() && getRemoveFields().isEmpty();
//     }
// 
//     public Set<String> getUpdateFields() {
//         return Sets.union(getSetFields(), getRemoveFields());
//     }
// 
//     public boolean isUpdateField(String field) {
//         return getSetFields().contains(field) || getRemoveFields().contains(field);
//     }
// }


import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.google.common.collect.ImmutableSet;
import io.stardog.stardao.core.TestModel;
import io.stardog.stardao.core.Update;
import org.junit.Test;
import java.time.LocalDate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
package io.stardog.stardao.jackson;




public class UpdateDeserializerTest {

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

        String json = "{\"name\":\"Marty\",\"birthday\":\"1985-10-26\",\"email\":null,\"country\":\"\"}";
        Update<TestModel> update = mapper.readValue(json, new TypeReference<Update<TestModel>>() {});
        assertEquals("Marty", update.getPartial().getName());
        assertEquals(LocalDate.of(1985, 10, 26), update.getPartial().getBirthday());
        assertNull(update.getPartial().getEmail());
        assertNull(update.getPartial().getCountry());
        assertEquals(ImmutableSet.of("email", "country"), update.getRemoveFields());
    }

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

        String json = "{\"active\":true}";
// Path: stardao-core/src/test/java/io/stardog/stardao/core/TestModel.java
// @AutoValue
// @JsonInclude(JsonInclude.Include.NON_NULL)
// @JsonDeserialize(builder=AutoValue_TestModel.Builder.class)
// public abstract class TestModel {
//     @Nullable
//     @Id
//     public abstract UUID getId();
// 
//     @Nullable
//     @Updatable
//     @NotEmpty(groups = Required.class)
//     public abstract String getName();
// 
//     @Nullable
//     @Updatable
//     @Email
//     @Pattern(regexp=".+@.+\\..+", message = "invalid email")
//     public abstract String getEmail();
// 
//     @Nullable
//     @Updatable
//     @NotEmpty(groups = Required.class)
//     public abstract String getCountry();
// 
//     @Nullable
//     @Updatable
//     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
//     public abstract LocalDate getBirthday();
// 
//     @Nullable
//     @Updatable
//     public abstract Boolean getActive();
// 
//     @Nullable
//     @CreatedBy
//     public abstract UUID getCreateId();
// 
//     @Nullable
//     @CreatedAt
//     public abstract Instant getCreateAt();
// 
//     @Nullable
//     @UpdatedBy
//     public abstract UUID getUpdateId();
// 
//     @Nullable
//     @UpdatedAt
//     public abstract Instant getUpdateAt();
// 
//     @Nullable
//     public abstract Instant getLoginAt();
// 
//     public Instant getLoginAt(long millis) {
//         return Instant.ofEpochMilli(millis);
//     }
// 
//     public abstract Builder toBuilder();
//     public static TestModel.Builder builder() {
//         return new AutoValue_TestModel.Builder();
//     }
// 
//     @AutoValue.Builder
//     @JsonPOJOBuilder(withPrefix = "")
//     public abstract static class Builder {
//         public abstract Builder id(UUID id);
//         public abstract Builder name(String name);
//         public abstract Builder email(String email);
//         public abstract Builder country(String state);
//         public abstract Builder birthday(LocalDate state);
//         public abstract Builder active(Boolean active);
//         public abstract Builder createAt(Instant at);
//         public abstract Builder createId(UUID id);
//         public abstract Builder updateAt(Instant at);
//         public abstract Builder updateId(UUID id);
//         public abstract Builder loginAt(Instant at);
//         public abstract TestModel build();
//     }
// }
// 
// Path: stardao-core/src/main/java/io/stardog/stardao/core/Update.java
// @AutoValue
// @JsonDeserialize(using = UpdateDeserializer.class)
// @JsonSerialize(using = UpdateSerializer.class)
// public abstract class Update<P> {
//     public abstract P getPartial();
//     public abstract Set<String> getSetFields();
//     public abstract Set<String> getRemoveFields();
// 
//     public static <T> Update<T> of(T setObject, Set<String> setFields) {
//         return new AutoValue_Update<>(setObject, setFields, ImmutableSet.of());
//     }
// 
//     public static <T> Update<T> of(T setObject, Set<String> setFields, Set<String> removeFields) {
//         return new AutoValue_Update<>(setObject, setFields, removeFields);
//     }
// 
//     public boolean isEmpty() {
//         return getSetFields().isEmpty() && getRemoveFields().isEmpty();
//     }
// 
//     public Set<String> getUpdateFields() {
//         return Sets.union(getSetFields(), getRemoveFields());
//     }
// 
//     public boolean isUpdateField(String field) {
//         return getSetFields().contains(field) || getRemoveFields().contains(field);
//     }
// }


// Path: stardao-core/src/test/java/io/stardog/stardao/jackson/UpdateDeserializerTest.java
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.google.common.collect.ImmutableSet;
import io.stardog.stardao.core.TestModel;
import io.stardog.stardao.core.Update;
import org.junit.Test;
import java.time.LocalDate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

package io.stardog.stardao.jackson;




public class UpdateDeserializerTest {

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

        String json = "{\"name\":\"Marty\",\"birthday\":\"1985-10-26\",\"email\":null,\"country\":\"\"}";
        Update<TestModel> update = mapper.readValue(json, new TypeReference<Update<TestModel>>() {});
        assertEquals("Marty", update.getPartial().getName());
        assertEquals(LocalDate.of(1985, 10, 26), update.getPartial().getBirthday());
        assertNull(update.getPartial().getEmail());
        assertNull(update.getPartial().getCountry());
        assertEquals(ImmutableSet.of("email", "country"), update.getRemoveFields());
    }

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

        String json = "{\"active\":true}";
        Update<TestModel> update = mapper.readValue(json, new TypeReference<Update<TestModel>>() {});