package com.njcn.gather.tool.adddata.component;

import com.njcn.gather.tool.adddata.pojo.vo.AddDataTemplateVO;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * 模板注册测试。
 */
class AddDataTemplateRegistryTest {

    @Test
    void shouldOnlyExposeABCTPhaseCodes() {
        AddDataTemplateRegistry registry = new AddDataTemplateRegistry();

        List<AddDataTemplateVO> templates = registry.getTemplates();
        Set<String> allowedPhaseCodes = new HashSet<String>();
        allowedPhaseCodes.add("A");
        allowedPhaseCodes.add("B");
        allowedPhaseCodes.add("C");
        allowedPhaseCodes.add("T");

        for (AddDataTemplateVO template : templates) {
            for (String phaseCode : template.getPhaseCodes()) {
                Assertions.assertTrue(allowedPhaseCodes.contains(phaseCode));
            }
        }
    }
}
