package com.ruoyi.loanpricing.mapper;

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

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.StreamUtils;

class LoanPricingWorkflowMapperXmlTest
{
    @Test
    void shouldUseRetailFinalCalculateRateInWorkflowListQuery() throws IOException
    {
        ClassPathResource resource = new ClassPathResource("mapper/loanpricing/LoanPricingWorkflowMapper.xml");
        String xml = StreamUtils.copyToString(resource.getInputStream(), StandardCharsets.UTF_8);

        assertTrue(xml.contains("WHEN lpw.cust_type = '个人' THEN mr.final_calculate_rate"));
        assertTrue(xml.contains("WHEN lpw.cust_type = '企业' THEN mc.calculate_rate"));
    }
}
