package com.njcn.gather.steady.checksquare.pojo.param;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.lang.reflect.Field;

/**
 * 数据校验查询参数契约测试。
 */
class SteadyChecksquareQueryParamTest {

    @Test
    void shouldOnlyExposeChecksquareQueryFields() {
        Assertions.assertNull(field("lineId"));
        Assertions.assertNotNull(field("lineIds"));
        Assertions.assertNotNull(field("indicatorCodes"));
        Assertions.assertNotNull(field("timeStart"));
        Assertions.assertNotNull(field("timeEnd"));
        Assertions.assertNull(field("qualityFlag"));
        Assertions.assertNull(field("statTypes"));
        Assertions.assertNull(field("phases"));
        Assertions.assertNull(field("harmonicOrders"));
    }

    private Field field(String name) {
        try {
            return SteadyChecksquareQueryParam.class.getDeclaredField(name);
        } catch (NoSuchFieldException ex) {
            return null;
        }
    }
}
