Title: Bad static method mocking · Issue #1128 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Bad static method mocking · Issue #1128 · UnitTestBot/UTBotJava
X Title: Bad static method mocking · Issue #1128 · UnitTestBot/UTBotJava
Description: Description Concrete Executor wrongly mocks static methods from different classes but with same signatures. To Reproduce Steps to reproduce the behavior: public class AlsoRandom { public static int next() { return -42; } public static in...
Open Graph Description: Description Concrete Executor wrongly mocks static methods from different classes but with same signatures. To Reproduce Steps to reproduce the behavior: public class AlsoRandom { public static int...
X Description: Description Concrete Executor wrongly mocks static methods from different classes but with same signatures. To Reproduce Steps to reproduce the behavior: public class AlsoRandom { public static int...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/1128
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bad static method mocking","articleBody":"**Description**\r\n\r\nConcrete Executor wrongly mocks static methods from different classes but with same signatures.\r\n\r\n**To Reproduce**\r\n\r\nSteps to reproduce the behavior:\r\n\r\n```java\r\npublic class AlsoRandom {\r\n public static int next() {\r\n return -42;\r\n }\r\n\r\n public static int foo() {\r\n return 1;\r\n }\r\n}\r\n\r\npublic class Random {\r\n public static int next() {\r\n return 42;\r\n }\r\n\r\n public static int foo() {\r\n return 0;\r\n }\r\n}\r\n\r\n\r\npublic class RandomUsage {\r\n public static int usage() {\r\n int value = Random.next();\r\n int a = Random.foo();\r\n int b = AlsoRandom.foo();\r\n if (value \u003e 50) {\r\n return a + b;\r\n }\r\n\r\n return AlsoRandom.next() - value;\r\n }\r\n}\r\n\r\n```\r\n\r\n1. Write some classes described above in new java project in IntelliJ Idea\r\n2. Use plugin to generate tests\r\n3. Run the generated test\r\n\r\n**Expected behavior**\r\n\r\nTests are passed.\r\n\r\n**Actual behavior**\r\n\r\nTests are failed.\r\n\r\n**Environment**\r\n\r\nMocking static methods from another class.\r\n","author":{"url":"https://github.com/SBOne-Kenobi","@type":"Person","name":"SBOne-Kenobi"},"datePublished":"2022-10-10T14:38:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1128/UTBotJava/issues/1128"}
| 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:96e7083f-77ed-cbf5-e5ec-d3fa0ef6aec9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 90AE:35A4EF:328624C:4486E7D:698DC777 |
| html-safe-nonce | c4f3cd5420deffe7b212f1d134974538a0bce30f60a30ba8561862e7e7e6d0c6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MEFFOjM1QTRFRjozMjg2MjRDOjQ0ODZFN0Q6Njk4REM3NzciLCJ2aXNpdG9yX2lkIjoiNTUwNzE1MDcwOTU4ODM0Njc0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 59a3418254d7ea5bc610fed246b1436bce8bb223b0743e3a82937f2deeb7a875 |
| hovercard-subject-tag | issue:1403285134 |
| 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/1128/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4ded9ac614d3e5cf70dc0be720a9ad752b1e1c8ed7dcf427ca0311e1557578a4/UnitTestBot/UTBotJava/issues/1128 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4ded9ac614d3e5cf70dc0be720a9ad752b1e1c8ed7dcf427ca0311e1557578a4/UnitTestBot/UTBotJava/issues/1128 |
| og:image:alt | Description Concrete Executor wrongly mocks static methods from different classes but with same signatures. To Reproduce Steps to reproduce the behavior: public class AlsoRandom { public static int... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SBOne-Kenobi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2457fd9a1b17ca7f38c3c2653895ccb2e0dd04f18f77446a21354e9bc4b7902f |
| 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 | 878672b82363fd98fbdc5bd0edb68e572c8a8d9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width