Title: Controller's method with `@PreAuthorize` generates infinitely many same tests. · Issue #2727 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Controller's method with `@PreAuthorize` generates infinitely many same tests. · Issue #2727 · UnitTestBot/UTBotJava
X Title: Controller's method with `@PreAuthorize` generates infinitely many same tests. · Issue #2727 · UnitTestBot/UTBotJava
Description: To Reproduce Generate integration tests for controller's method which has @PreAuthorize, e.g. @GetMapping("/demo") @PreAuthorize("hasAuthority('write')") public String demo() { return "demo"; } Expected behavior Probably shouldn't have t...
Open Graph Description: To Reproduce Generate integration tests for controller's method which has @PreAuthorize, e.g. @GetMapping("/demo") @PreAuthorize("hasAuthority('write')") public String demo() { return "demo"; } Exp...
X Description: To Reproduce Generate integration tests for controller's method which has @PreAuthorize, e.g. @GetMapping("/demo") @PreAuthorize("hasAuthority('write')") public Stri...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/2727
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Controller's method with `@PreAuthorize` generates infinitely many same tests.","articleBody":"**To Reproduce**\r\nGenerate integration tests for controller's method which has `@PreAuthorize`, e.g.\r\n```java\r\n @GetMapping(\"/demo\")\r\n @PreAuthorize(\"hasAuthority('write')\")\r\n public String demo() {\r\n return \"demo\";\r\n }\r\n```\r\n**Expected behavior**\r\n\r\nProbably shouldn't have this test since it tests nothing.\r\n\r\n**Actual behavior**\r\n\r\n```java\r\n ///region FUZZER: ERROR SUITE for method demo()\r\n /// Actual number of generated tests (4964) exceeds per-method limit (50)\r\n /// The limit can be configured in '{HOME_DIR}/.utbot/settings.properties' with 'maxTestsPerMethod' property\r\n\r\n /**\r\n * @utbot.classUnderTest {@link NameController}\r\n * @utbot.methodUnderTest {@link NameController#demo()}\r\n */\r\n @Test\r\n @DisplayName(\"demo: -\u003e throw AccessDeniedException\")\r\n public void testDemoThrowsADE() {\r\n /* This test fails because method [com.laurentiuspilca.ssia.controllers.NameController.demo] produces [org.springframework.security.access.AccessDeniedException: Access is denied] */\r\n nameController.demo();\r\n }\r\n\r\n /**\r\n * @utbot.classUnderTest {@link NameController}\r\n * @utbot.methodUnderTest {@link NameController#demo()}\r\n */\r\n @Test\r\n @DisplayName(\"demo: -\u003e throw AccessDeniedException\")\r\n public void testDemoThrowsADE1() {\r\n /* This test fails because method [com.laurentiuspilca.ssia.controllers.NameController.demo] produces [org.springframework.security.access.AccessDeniedException: Access is denied] */\r\n nameController.demo();\r\n }\r\n\r\n /**\r\n * @utbot.classUnderTest {@link NameController}\r\n * @utbot.methodUnderTest {@link NameController#demo()}\r\n */\r\n @Test\r\n @DisplayName(\"demo: -\u003e throw AccessDeniedException\")\r\n public void testDemoThrowsADE2() {\r\n /* This test fails because method [com.laurentiuspilca.ssia.controllers.NameController.demo] produces [org.springframework.security.access.AccessDeniedException: Access is denied] */\r\n nameController.demo();\r\n }\r\n \r\n // and so on\r\n```\r\n","author":{"url":"https://github.com/ancavar","@type":"Person","name":"ancavar"},"datePublished":"2023-12-19T19:58:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2727/UTBotJava/issues/2727"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:179ad604-ce97-6427-afa8-4d4d4af4d878 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8484:348F32:3CF31A:50B3B1:698D0AB4 |
| html-safe-nonce | 55abad58c359c1a48344af8f1ede71ecd9e7ae136ff9ab60a623effe00f13fde |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDg0OjM0OEYzMjozQ0YzMUE6NTBCM0IxOjY5OEQwQUI0IiwidmlzaXRvcl9pZCI6IjI5MzcxNjI0ODI5MTE2MTE1NzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 51126a6ab751ec3b1b4477fcdbdb92b0bd392a2ece89c43671e4909e2078d415 |
| hovercard-subject-tag | issue:2049349423 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/UnitTestBot/UTBotJava/2727/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e389d17e33dcd4e234e7cf5aeec13934a0a1336778f9b5ce88c5c994c5d1baf4/UnitTestBot/UTBotJava/issues/2727 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e389d17e33dcd4e234e7cf5aeec13934a0a1336778f9b5ce88c5c994c5d1baf4/UnitTestBot/UTBotJava/issues/2727 |
| og:image:alt | To Reproduce Generate integration tests for controller's method which has @PreAuthorize, e.g. @GetMapping("/demo") @PreAuthorize("hasAuthority('write')") public String demo() { return "demo"; } Exp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ancavar |
| hostname | github.com |
| expected-hostname | github.com |
| None | f2da95634bce8a94cfa4123788169bfabdf845fd1d790fbaaaaab09dcfebdf28 |
| turbo-cache-control | no-preview |
| go-import | github.com/UnitTestBot/UTBotJava git https://github.com/UnitTestBot/UTBotJava.git |
| octolytics-dimension-user_id | 87413538 |
| octolytics-dimension-user_login | UnitTestBot |
| octolytics-dimension-repository_id | 480810501 |
| octolytics-dimension-repository_nwo | UnitTestBot/UTBotJava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 480810501 |
| octolytics-dimension-repository_network_root_nwo | UnitTestBot/UTBotJava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 311e6780106f89302807c2d4e7790575cc939515 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width