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


import static com.github.rschmitt.dynamicobject.DynamicObject.deserialize;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.UUID;
import java.util.function.BiFunction;
import org.junit.jupiter.api.Test;
package com.github.rschmitt.dynamicobject;




public class MethodHandleTest {
    private static final UUID ReceiptHandle = UUID.randomUUID();

    @Test
    public void buildPolymorphically() {
        String edn = "{:command \"start the reactor\"}";

        QueueMessage queueMessage = deserializeAndAttachMetadata(edn, QueueMessage::receiptHandle, QueueMessage.class);

        assertEquals(ReceiptHandle, queueMessage.receiptHandle());
        assertEquals("start the reactor", queueMessage.command());
    }

    private <T> T deserializeAndAttachMetadata(String edn, BiFunction<T, UUID, T> receiptHandleMetadataBuilder, Class<T> type) {
// 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/test/java/com/github/rschmitt/dynamicobject/MethodHandleTest.java
import static com.github.rschmitt.dynamicobject.DynamicObject.deserialize;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.UUID;
import java.util.function.BiFunction;
import org.junit.jupiter.api.Test;

package com.github.rschmitt.dynamicobject;




public class MethodHandleTest {
    private static final UUID ReceiptHandle = UUID.randomUUID();

    @Test
    public void buildPolymorphically() {
        String edn = "{:command \"start the reactor\"}";

        QueueMessage queueMessage = deserializeAndAttachMetadata(edn, QueueMessage::receiptHandle, QueueMessage.class);

        assertEquals(ReceiptHandle, queueMessage.receiptHandle());
        assertEquals("start the reactor", queueMessage.command());
    }

    private <T> T deserializeAndAttachMetadata(String edn, BiFunction<T, UUID, T> receiptHandleMetadataBuilder, Class<T> type) {
        T instance = deserialize(edn, type);