package com.njcn.gather.steady.checksquare.controller;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.lang.reflect.Method;

/**
 * 数据校验接口契约测试。
 */
class SteadyChecksquareControllerTest {

    @Test
    void shouldExposeChecksquareQueryEndpointInSeparateController() throws Exception {
        RequestMapping requestMapping = SteadyChecksquareController.class.getAnnotation(RequestMapping.class);
        Assertions.assertArrayEquals(new String[]{"/steady/data-view/checksquare"}, requestMapping.value());

        Method method = SteadyChecksquareController.class.getDeclaredMethod("query", com.njcn.gather.steady.checksquare.pojo.param.SteadyChecksquareQueryParam.class);
        PostMapping postMapping = method.getAnnotation(PostMapping.class);
        Assertions.assertArrayEquals(new String[]{"/query"}, postMapping.value());
    }
}
