package com.battery.business.web;
|
|
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"));
|
assertFalse(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);
|
}
|
}
|