package com.ruoyi.info.collection.mapper;

import org.junit.jupiter.api.Test;

import java.io.InputStream;
import java.nio.charset.StandardCharsets;

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

class CcdiIntermediaryMapperTest {

    @Test
    void mapperXml_shouldContainThreeRecordTypesAndRelatedKeywordQuery() throws Exception {
        try (InputStream inputStream = getClass().getClassLoader()
                .getResourceAsStream("mapper/info/collection/CcdiIntermediaryMapper.xml")) {
            String xml = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);

            assertTrue(xml.contains("INTERMEDIARY"), xml);
            assertTrue(xml.contains("RELATIVE"), xml);
            assertTrue(xml.contains("ENTERPRISE_RELATION"), xml);
            assertTrue(xml.contains("relatedIntermediaryKeyword"), xml);
            assertTrue(xml.contains("related_intermediary_name"), xml);
            assertTrue(xml.contains("relation_text"), xml);
            assertTrue(xml.contains("CAST('实体'"), xml);
        }
    }
}
