// 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 <T> T fromFressianByteArray(byte[] bytes) {
//     return FressianSerialization.fromFressianByteArray(bytes);
// }
// 
// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static String serialize(Object o) {
//     return EdnSerialization.serialize(o);
// }
// 
// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static byte[] toFressianByteArray(Object o) {
//     return FressianSerialization.toFressianByteArray(o);
// }
// 
// Path: src/test/java/com/github/rschmitt/dynamicobject/TestUtils.java
// public static void assertEquivalent(String expected, String actual) {
//     assertEquals(genericRead(expected), genericRead(actual));
// }


import static com.github.rschmitt.dynamicobject.DynamicObject.deserialize;
import static com.github.rschmitt.dynamicobject.DynamicObject.fromFressianByteArray;
import static com.github.rschmitt.dynamicobject.DynamicObject.serialize;
import static com.github.rschmitt.dynamicobject.DynamicObject.toFressianByteArray;
import static com.github.rschmitt.dynamicobject.TestUtils.assertEquivalent;
import static java.lang.String.format;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.fressian.Reader;
import org.fressian.Writer;
import org.fressian.handlers.ReadHandler;
import org.fressian.handlers.WriteHandler;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
package com.github.rschmitt.dynamicobject;




public class ExtensibilityTest {
    private static final String Edn = "#dh{:dumb [#MyDumbClass{:version 1, :str \"str\"}]}";

    @BeforeEach
    public void setup() {
        DynamicObject.registerType(DumbClass.class, new DumbClassTranslator());
        DynamicObject.registerTag(DumbClassHolder.class, "dh");
        DynamicObject.registerType(DumbClass.class, "dumb", new DumbClassReader(), new DumbClassWriter());
    }

    @AfterEach
    public void teardown() {
        DynamicObject.deregisterType(DumbClass.class);
        DynamicObject.deregisterTag(DumbClassHolder.class);
    }

    @Test
    public void roundTrip() {
        DumbClassHolder holder = deserialize(Edn, DumbClassHolder.class);

        String serialized = serialize(holder);

        assertEquivalent(Edn, serialized);
        assertEquals(new DumbClass(1, "str"), holder.dumb().get(0));
// 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 <T> T fromFressianByteArray(byte[] bytes) {
//     return FressianSerialization.fromFressianByteArray(bytes);
// }
// 
// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static String serialize(Object o) {
//     return EdnSerialization.serialize(o);
// }
// 
// Path: src/main/java/com/github/rschmitt/dynamicobject/DynamicObject.java
// static byte[] toFressianByteArray(Object o) {
//     return FressianSerialization.toFressianByteArray(o);
// }
// 
// Path: src/test/java/com/github/rschmitt/dynamicobject/TestUtils.java
// public static void assertEquivalent(String expected, String actual) {
//     assertEquals(genericRead(expected), genericRead(actual));
// }


// Path: src/test/java/com/github/rschmitt/dynamicobject/ExtensibilityTest.java
import static com.github.rschmitt.dynamicobject.DynamicObject.deserialize;
import static com.github.rschmitt.dynamicobject.DynamicObject.fromFressianByteArray;
import static com.github.rschmitt.dynamicobject.DynamicObject.serialize;
import static com.github.rschmitt.dynamicobject.DynamicObject.toFressianByteArray;
import static com.github.rschmitt.dynamicobject.TestUtils.assertEquivalent;
import static java.lang.String.format;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.fressian.Reader;
import org.fressian.Writer;
import org.fressian.handlers.ReadHandler;
import org.fressian.handlers.WriteHandler;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

package com.github.rschmitt.dynamicobject;




public class ExtensibilityTest {
    private static final String Edn = "#dh{:dumb [#MyDumbClass{:version 1, :str \"str\"}]}";

    @BeforeEach
    public void setup() {
        DynamicObject.registerType(DumbClass.class, new DumbClassTranslator());
        DynamicObject.registerTag(DumbClassHolder.class, "dh");
        DynamicObject.registerType(DumbClass.class, "dumb", new DumbClassReader(), new DumbClassWriter());
    }

    @AfterEach
    public void teardown() {
        DynamicObject.deregisterType(DumbClass.class);
        DynamicObject.deregisterTag(DumbClassHolder.class);
    }

    @Test
    public void roundTrip() {
        DumbClassHolder holder = deserialize(Edn, DumbClassHolder.class);

        String serialized = serialize(holder);

        assertEquivalent(Edn, serialized);
        assertEquals(new DumbClass(1, "str"), holder.dumb().get(0));
        assertEquals(holder, fromFressianByteArray(toFressianByteArray(holder)));