| | |
| | | import java.lang.reflect.Method; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | |
| | | class TTestControllerContractTest |
| | |
| | | assertPermission("resumeReception", "@ss.hasPermi('system:test:resume')", Long.class); |
| | | assertEquals("/{testId}/reception/resume", TTestController.class.getMethod("resumeReception", Long.class) |
| | | .getAnnotation(PostMapping.class).value()[0]); |
| | | assertEquals("/{testId}/reception/intervals", TTestController.class.getMethod("receptionIntervals", Long.class) |
| | | .getAnnotation(GetMapping.class).value()[0]); |
| | | assertPermission("stopTest", "@ss.hasPermi('system:test:stop')", Long.class); |
| | | assertEquals("/{testId}/stop", TTestController.class.getMethod("stopTest", Long.class) |
| | | .getAnnotation(PostMapping.class).value()[0]); |
| | | } |
| | | |
| | | private void assertPermission(String methodName, String permission, Class<?>... parameterTypes) throws Exception |