Title: NullPointerException in runtime for Random without static mocking · Issue #447 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: NullPointerException in runtime for Random without static mocking · Issue #447 · UnitTestBot/UTBotJava
X Title: NullPointerException in runtime for Random without static mocking · Issue #447 · UnitTestBot/UTBotJava
Description: Description Without mockito-inline force mocked statics generate NPE in runtime. To Reproduce Steps to reproduce the behavior: Example: Open any project in IDEA Create such class: import java.util.Random; public class Rand { public boole...
Open Graph Description: Description Without mockito-inline force mocked statics generate NPE in runtime. To Reproduce Steps to reproduce the behavior: Example: Open any project in IDEA Create such class: import java.util....
X Description: Description Without mockito-inline force mocked statics generate NPE in runtime. To Reproduce Steps to reproduce the behavior: Example: Open any project in IDEA Create such class: import java.util....
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/447
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NullPointerException in runtime for Random without static mocking","articleBody":"**Description**\r\n\r\nWithout mockito-inline force mocked statics generate NPE in runtime.\r\n\r\n**To Reproduce**\r\n\r\nSteps to reproduce the behavior:\r\n\r\n_Example:_\r\n\r\n1. Open any project in IDEA\r\n2. Create such class:\r\n```\r\nimport java.util.Random;\r\n\r\npublic class Rand {\r\n public boolean rand(int a) {\r\n Random r = new Random();\r\n return r.nextInt() \u003e a;\r\n }\r\n}\r\n```\r\n3. Generate tests with \"No static mocking\"\r\n\r\n**Expected behavior**\r\n\r\nTests are generated and run without errors.\r\n\r\n**Actual behavior**\r\n\r\nNPE is generated for tests where mock statics are forced.\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\n\r\n\r\n\r\n**Environment**\r\n\r\nNot suitable.\r\n\r\n**Additional context**\r\n\r\nThis case should be treated exactly like force mocking case.\r\n","author":{"url":"https://github.com/nikitavlaev","@type":"Person","name":"nikitavlaev"},"datePublished":"2022-07-06T16:06:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/447/UTBotJava/issues/447"}
| 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:8c07cde0-c4e3-4811-7c2b-889f4a2af7b3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE56:12779A:19BD1D4:2160477:698FE2A8 |
| html-safe-nonce | 4eb730800e5dde0565590e4299c1c3f6c3fdc18a0169e93c377083d314620928 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTU2OjEyNzc5QToxOUJEMUQ0OjIxNjA0Nzc6Njk4RkUyQTgiLCJ2aXNpdG9yX2lkIjoiNDk5ODM3MTU2Mzc2MzkxNzQ4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6c0eab0f4d7ddd0627e35ef3b413d8e546d2d58cac265272ed5917d96fa0954d |
| hovercard-subject-tag | issue:1296062818 |
| 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/447/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1f5e4d2f82a9a4ec9fc2c00251fd035fafbbb3fa85e873d2a1ddd04760bb29fc/UnitTestBot/UTBotJava/issues/447 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1f5e4d2f82a9a4ec9fc2c00251fd035fafbbb3fa85e873d2a1ddd04760bb29fc/UnitTestBot/UTBotJava/issues/447 |
| og:image:alt | Description Without mockito-inline force mocked statics generate NPE in runtime. To Reproduce Steps to reproduce the behavior: Example: Open any project in IDEA Create such class: import java.util.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nikitavlaev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| 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 | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width