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: github.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:7b8ce925-532a-62a2-b619-2ac29a4e2a96 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A814:182825:B74640:EF849B:698EBDCA |
| html-safe-nonce | f404bdeb346cf797af78c992a03770e797202d7f07db367948967e79fe845603 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODE0OjE4MjgyNTpCNzQ2NDA6RUY4NDlCOjY5OEVCRENBIiwidmlzaXRvcl9pZCI6IjM4MTk0NzQ4MzQ0NDM5NTQ2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 309cea08246a63947bcfa6bc5aa3e26e580744951509099d7d07bb7be3a1a6be |
| 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 | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| 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 | e6b91a7e6e46287d26887e3fb7a4161657bab8f7 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width