Title: Concrete execution fails for a static method using a static field · Issue #711 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Concrete execution fails for a static method using a static field · Issue #711 · UnitTestBot/UTBotJava
X Title: Concrete execution fails for a static method using a static field · Issue #711 · UnitTestBot/UTBotJava
Description: Description Static method without input parameters is using a static field inside. Concrete execution fails with "java.lang.IllegalArgumentException: wrong number of arguments" To Reproduce Steps to reproduce the behavior: IntelliJ IDEA ...
Open Graph Description: Description Static method without input parameters is using a static field inside. Concrete execution fails with "java.lang.IllegalArgumentException: wrong number of arguments" To Reproduce Steps t...
X Description: Description Static method without input parameters is using a static field inside. Concrete execution fails with "java.lang.IllegalArgumentException: wrong number of arguments" To Reprodu...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/711
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Concrete execution fails for a static method using a static field","articleBody":"**Description**\r\n\r\nStatic method without input parameters is using a static field inside.\r\nConcrete execution fails with \"java.lang.IllegalArgumentException: wrong number of arguments\"\r\n\r\n**To Reproduce**\r\n\r\nSteps to reproduce the behavior:\r\n\r\n1. IntelliJ IDEA with UTBot installed is running.\r\n2. Turn fuzzing on // File -\u003e Settings -\u003e Tools -\u003e UTbot -\u003e select some middle Code Analysis slider position \r\n3. Run test generation for the following class:\r\n\r\n```java\r\npublic class CheckStatic {\r\n\r\n public final static Integer keyValue = 420;\r\n\r\n public static int check() {\r\n if (keyValue == 0) {\r\n return keyValue;\r\n } else {\r\n return -keyValue;\r\n }\r\n }\r\n\r\n}\r\n\r\n```\r\n\r\n**Expected behavior**\r\n\r\nTests are supposed to be generated without errors.\r\n\r\n**Actual behavior**\r\n\r\nAn error test is generated with information about an error in the concrete executor.\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\n\r\nError report:\r\n```java\r\n public void testCheck_errors() {\r\n // Couldn't generate some tests. List of errors:\r\n // \r\n // 4 occurrences of:\r\n // Default concrete execution failed\r\n\r\n }\r\n```\r\n\r\nChild process error:\r\n~~~\r\nTransforming: org/example/CheckStatic\r\njava.lang.IllegalArgumentException: wrong number of arguments\r\nsignature=check()I\r\nthis=null: org.example.CheckStatic\r\narguments={\r\norg.example.CheckStatic@1ad9c76c: org.example.CheckStatic\r\n}\r\n\r\n\tat org.utbot.instrumentation.instrumentation.InvokeInstrumentation.invoke-d1pmJ48(InvokeInstrumentation.kt:77)\r\n\tat org.utbot.instrumentation.instrumentation.InvokeInstrumentation.invoke(InvokeInstrumentation.kt:17)\r\n\tat org.utbot.instrumentation.instrumentation.Instrumentation$DefaultImpls.invoke$default(Instrumentation.kt:25)\r\n\tat org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$$inlined$withReflection$lambda$1$1.invoke(UtExecutionInstrumentation.kt:163)\r\n\tat org.utbot.common.ThreadBasedExecutor$invokeWithTimeout$2.invoke(ThreadUtil.kt:56)\r\n\tat org.utbot.common.ThreadBasedExecutor$invokeWithTimeout$1.invoke(ThreadUtil.kt:47)\r\n\tat org.utbot.common.ThreadBasedExecutor$invokeWithTimeout$1.invoke(ThreadUtil.kt:22)\r\n\tat kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)\r\n~~~\r\n\r\n**Environment**\r\n\r\nWindows 10 Pro\r\nGradle 6.8\r\nJDK 8 \r\n\r\n**Additional context**\r\n\r\nThe example was taken from utbot-sample/src/main/java/org/utbot/examples/mock/CommonMocksExample.java - just added \"static\" to the clinitMockExample() definition.","author":{"url":"https://github.com/alisevych","@type":"Person","name":"alisevych"},"datePublished":"2022-08-11T11:03:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/711/UTBotJava/issues/711"}
| 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:42b8bac4-a915-9cb6-ef6e-7468a63bdcb5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E50:B1B60:26591E8:33D6BF8:698DAFDA |
| html-safe-nonce | 6ad8de94b82fc3a606244d035f303244c5d5bbd18b216f21250e84e6f4cf2aa5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTUwOkIxQjYwOjI2NTkxRTg6MzNENkJGODo2OThEQUZEQSIsInZpc2l0b3JfaWQiOiIyODY3MzUzMzg1ODU3NTYwNTM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 64185b168f6dc8a064006dc844223648e51498fc85cc0ff08cd5a69e46a518be |
| hovercard-subject-tag | issue:1335802671 |
| 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/711/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bd277ca4312c7a43bf3c9a459bd54e0895288759b8ad25167e29b9177b87241a/UnitTestBot/UTBotJava/issues/711 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bd277ca4312c7a43bf3c9a459bd54e0895288759b8ad25167e29b9177b87241a/UnitTestBot/UTBotJava/issues/711 |
| og:image:alt | Description Static method without input parameters is using a static field inside. Concrete execution fails with "java.lang.IllegalArgumentException: wrong number of arguments" To Reproduce Steps t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alisevych |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8c7947c0c592efeab6162b9909ad11fa43bff8b0cb5ff43273dc25e41979d43e |
| 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 | b22a9fbf4dea601ec149a9e5362e0558df79b505 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width