package dev.lions.user.manager.config;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.jackson.ObjectMapperCustomizer;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

/**
 * Tests unitaires pour JacksonConfig
 */
class JacksonConfigTest {

    private JacksonConfig jacksonConfig;
    private ObjectMapper objectMapper;

    @BeforeEach
    void setUp() {
        jacksonConfig = new JacksonConfig();
        objectMapper = new ObjectMapper();
    }

    @Test
    void testCustomize() {
        // Avant la personnalisation, FAIL_ON_UNKNOWN_PROPERTIES devrait être true par défaut
        assertTrue(objectMapper.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));

        // Appliquer la personnalisation
        jacksonConfig.customize(objectMapper);

        // Après la personnalisation, FAIL_ON_UNKNOWN_PROPERTIES devrait être false
        assertFalse(objectMapper.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
    }

    @Test
    void testImplementsObjectMapperCustomizer() {
        assertTrue(jacksonConfig instanceof ObjectMapperCustomizer);
    }
}
