// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static <T> T deserialize(String edn, Class<T> type) {
//     return EdnSerialization.deserialize(edn, type);
// }
// 
// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static <D extends DynamicObject<D>> D newInstance(Class<D> type) {
//     return Instances.newInstance(type);
// }
// 
// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static String serialize(Object o) {
//     return EdnSerialization.serialize(o);
// }


import static com.github.rschmitt.dynamicobject.DynamicObject.deserialize;
import static com.github.rschmitt.dynamicobject.DynamicObject.newInstance;
import static com.github.rschmitt.dynamicobject.DynamicObject.serialize;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.Instant;
import java.util.Date;
import org.junit.jupiter.api.Test;
    public void instantBuilder() {
        Instant expected = Instant.parse("1985-04-12T23:20:50.52Z");

        TimeWrapper timeWrapper = newInstance(TimeWrapper.class).instant(expected);

        assertEquals(expected, timeWrapper.instant());
        assertEquals("{:instant #inst \"1985-04-12T23:20:50.520-00:00\"}", serialize(timeWrapper));
    }

    @Test
    public void dateParser() {
        String edn = "{:date #inst \"1985-04-12T23:20:50.520-00:00\"}";
        Date expected = Date.from(Instant.parse("1985-04-12T23:20:50.52Z"));

        TimeWrapper timeWrapper = deserialize(edn, TimeWrapper.class);

        assertEquals(expected, timeWrapper.date());
    }

    @Test
    public void instantParser() {
        String edn = "{:instant #inst \"1985-04-12T23:20:50.520-00:00\"}";
        Instant expected = Instant.parse("1985-04-12T23:20:50.52Z");

        TimeWrapper timeWrapper = deserialize(edn, TimeWrapper.class);

        assertEquals(expected, timeWrapper.instant());
        assertEquals(edn, serialize(timeWrapper));
    }

// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static <T> T deserialize(String edn, Class<T> type) {
//     return EdnSerialization.deserialize(edn, type);
// }
// 
// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static <D extends DynamicObject<D>> D newInstance(Class<D> type) {
//     return Instances.newInstance(type);
// }
// 
// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static String serialize(Object o) {
//     return EdnSerialization.serialize(o);
// }


// Path: src/test/java/com/github/rschmitt/dynamicobject/InstantTest.java
import static com.github.rschmitt.dynamicobject.DynamicObject.deserialize;
import static com.github.rschmitt.dynamicobject.DynamicObject.newInstance;
import static com.github.rschmitt.dynamicobject.DynamicObject.serialize;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.Instant;
import java.util.Date;
import org.junit.jupiter.api.Test;

    public void instantBuilder() {
        Instant expected = Instant.parse("1985-04-12T23:20:50.52Z");

        TimeWrapper timeWrapper = newInstance(TimeWrapper.class).instant(expected);

        assertEquals(expected, timeWrapper.instant());
        assertEquals("{:instant #inst \"1985-04-12T23:20:50.520-00:00\"}", serialize(timeWrapper));
    }

    @Test
    public void dateParser() {
        String edn = "{:date #inst \"1985-04-12T23:20:50.520-00:00\"}";
        Date expected = Date.from(Instant.parse("1985-04-12T23:20:50.52Z"));

        TimeWrapper timeWrapper = deserialize(edn, TimeWrapper.class);

        assertEquals(expected, timeWrapper.date());
    }

    @Test
    public void instantParser() {
        String edn = "{:instant #inst \"1985-04-12T23:20:50.520-00:00\"}";
        Instant expected = Instant.parse("1985-04-12T23:20:50.52Z");

        TimeWrapper timeWrapper = deserialize(edn, TimeWrapper.class);

        assertEquals(expected, timeWrapper.instant());
        assertEquals(edn, serialize(timeWrapper));
    }

    public interface TimeWrapper extends DynamicObject<TimeWrapper> {