Title: Fuzzer ignores generics of `class StringMap extends HashMap
Open Graph Title: Fuzzer ignores generics of `class StringMap extends HashMap
X Title: Fuzzer ignores generics of `class StringMap extends HashMap
Description: Description Fuzzer tries to put arbitrary Objects into StringMap To Reproduce Set fuzzing to 100% Generate tests for the following class public class StringMap extends HashMap
Open Graph Description: Description Fuzzer tries to put arbitrary Objects into StringMap To Reproduce Set fuzzing to 100% Generate tests for the following class public class StringMap extends HashMap
X Description: Description Fuzzer tries to put arbitrary Objects into StringMap To Reproduce Set fuzzing to 100% Generate tests for the following class public class StringMap extends HashMap<String, String>...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/2571
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fuzzer ignores generics of `class StringMap extends HashMap\u003cString, String\u003e`","articleBody":"**Description**\r\n\r\nFuzzer tries to put arbitrary `Objects` into `StringMap`\r\n\r\n**To Reproduce**\r\n\r\n* Set fuzzing to `100%`\r\n* Generate tests for the following class\r\n\r\n```java\r\npublic class StringMap extends HashMap\u003cString, String\u003e {\r\n public String getAnyString() {\r\n return keySet().iterator().next();\r\n }\r\n}\r\n```\r\n\r\n**Expected behavior**\r\n\r\nThere's one passing and one failing test.\r\n\r\n**Actual behavior**\r\n\r\nNo passing tests are generated, one of the tests fails to compile with the following error: \"incompatible types: `Object` cannot be converted to `String` `stringMap.put(object, object1);`\".\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\n\r\n```java\r\n/**\r\n * @utbot.classUnderTest {@link StringMap}\r\n * @utbot.methodUnderTest {@link StringMap#getAnyString()}\r\n */\r\n@Test\r\n@DisplayName(\"getAnyString: -\u003e throw ClassCastException\")\r\npublic void testGetAnyStringThrowsCCE() {\r\n StringMap stringMap = new StringMap();\r\n Object object = new Object();\r\n Object object1 = new Object();\r\n stringMap.put(object, object1);\r\n \r\n /* This test fails because method [org.example.StringMap.getAnyString] produces [java.lang.ClassCastException: class java.lang.Object cannot be cast to class java.lang.String (java.lang.Object and java.lang.String are in module java.base of loader 'bootstrap')]\r\n org.example.StringMap.getAnyString(StringMap.java:7) */\r\n stringMap.getAnyString();\r\n}\r\n```\r\n","author":{"url":"https://github.com/IlyaMuravjov","@type":"Person","name":"IlyaMuravjov"},"datePublished":"2023-08-31T10:36:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/2571/UTBotJava/issues/2571"}
| 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:d2af4d08-4aab-bcca-b418-da52031b4038 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D6E4:D4DD7:553958:74B166:698E05ED |
| html-safe-nonce | ce00cc83b8ae7312a952911778f7b2400aad8cb27d7e2b8ee08c7253e99f874d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkU0OkQ0REQ3OjU1Mzk1ODo3NEIxNjY6Njk4RTA1RUQiLCJ2aXNpdG9yX2lkIjoiNTU4MzU2MTg1NDI3NjIwODEwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 46717261869a4bc49890a723b2daf50808c08862f6b646d404939d27ee08c24d |
| hovercard-subject-tag | issue:1875253857 |
| 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/2571/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5ecfaf336148aa90044930fc62dfa1aa6a1f219f4f562d3dcf4802366335bb20/UnitTestBot/UTBotJava/issues/2571 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5ecfaf336148aa90044930fc62dfa1aa6a1f219f4f562d3dcf4802366335bb20/UnitTestBot/UTBotJava/issues/2571 |
| og:image:alt | Description Fuzzer tries to put arbitrary Objects into StringMap To Reproduce Set fuzzing to 100% Generate tests for the following class public class StringMap extends HashMap |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | IlyaMuravjov |
| hostname | github.com |
| expected-hostname | github.com |
| None | 70a88bfe6d9639434ae7f5a46d15c336b8884978a51526bc55fc57d848f1e3c1 |
| 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 | 2519b16db5550494a653f9a8837c14ef7df80804 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width