| | |
| | | import static org.junit.jupiter.api.Assertions.assertEquals; |
| | | import java.lang.reflect.Method; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | |
| | | class TTestControllerContractTest |
| | |
| | | assertPermission("getInfo", "@ss.hasPermi('system:test:query')", Long.class); |
| | | assertPermission("add", "@ss.hasPermi('system:test:add')", com.ruoyi.system.domain.TTest.class); |
| | | assertPermission("edit", "@ss.hasPermi('system:test:edit')", com.ruoyi.system.domain.TTest.class); |
| | | assertPermission("startReception", "@ss.hasPermi('system:test:start')", Long.class); |
| | | Method startReception = TTestController.class.getMethod("startReception", Long.class); |
| | | assertEquals("/{testId}/reception/start", startReception.getAnnotation(PostMapping.class).value()[0]); |
| | | } |
| | | |
| | | private void assertPermission(String methodName, String permission, Class<?>... parameterTypes) throws Exception |