package com.ruoyi.ccdi.project.mapper;

import org.junit.jupiter.api.Test;

import java.nio.file.Files;
import java.nio.file.Path;

import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertTrue;

class CcdiProjectOverviewEmployeeResultMapperXmlTest {

    private static final Path MAPPER_PATH = Path.of(
        "src/main/java/com/ruoyi/ccdi/project/mapper/CcdiProjectOverviewEmployeeResultMapper.java"
    );
    private static final Path XML_PATH = Path.of(
        "src/main/resources/mapper/ccdi/project/CcdiProjectOverviewEmployeeResultMapper.xml"
    );

    @Test
    void mapperAndXmlShouldExposeMinimumCrudStatements() throws Exception {
        String mapperSource = Files.readString(MAPPER_PATH);
        String xml = Files.readString(XML_PATH);

        assertAll(
            () -> assertTrue(mapperSource.contains("interface CcdiProjectOverviewEmployeeResultMapper")),
            () -> assertTrue(mapperSource.contains("deleteByProjectId")),
            () -> assertTrue(mapperSource.contains("insertBatch")),
            () -> assertTrue(mapperSource.contains("selectByProjectId")),
            () -> assertTrue(xml.contains("delete id=\"deleteByProjectId\"")),
            () -> assertTrue(xml.contains("insert id=\"insertBatch\"")),
            () -> assertTrue(xml.contains("select id=\"selectByProjectId\"")),
            () -> assertTrue(xml.contains("ccdi_project_overview_employee_result"))
        );
    }
}
