yeg
2026-08-31 41dce73ba68e706bb876b3712a14cecb0269c962
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.ruoyi.web.controller.system;
 
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.junit.jupiter.api.Test;
import org.springframework.web.bind.annotation.GetMapping;
 
/** Ticket20:删除全局结果查询入口,同时保留测试控制台结果入口。 */
class Ticket20ResultQueryRemovalTest
{
    @Test
    void globalResultQueryIsRemovedButTestScopedResultsRemain()
    {
        Method[] methods = TTestController.class.getDeclaredMethods();
 
        assertFalse(hasGetMapping(methods, "/results"));
        assertTrue(hasGetMapping(methods, "/{testId}/results"));
    }
 
    private boolean hasGetMapping(Method[] methods, String path)
    {
        return Arrays.stream(methods)
                .map(method -> method.getAnnotation(GetMapping.class))
                .filter(mapping -> mapping != null)
                .flatMap(mapping -> Arrays.stream(mapping.value()))
                .anyMatch(path::equals);
    }
}