Title: Enum class is addressed incorrectly · Issue #1210 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Enum class is addressed incorrectly · Issue #1210 · UnitTestBot/UTBotJava
X Title: Enum class is addressed incorrectly · Issue #1210 · UnitTestBot/UTBotJava
Description: Description When Enum class is created by className, it addresses not class but the Enum constant. To Reproduce Run the 'UTBotJava' project in IntelliJ Idea Install plugin build or one of the latest builds from main. Reproducing on more ...
Open Graph Description: Description When Enum class is created by className, it addresses not class but the Enum constant. To Reproduce Run the 'UTBotJava' project in IntelliJ Idea Install plugin build or one of the lates...
X Description: Description When Enum class is created by className, it addresses not class but the Enum constant. To Reproduce Run the 'UTBotJava' project in IntelliJ Idea Install plugin build or one of t...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/1210
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enum class is addressed incorrectly","articleBody":"**Description**\r\n\r\nWhen Enum class is created by className, it addresses not class but the Enum constant.\r\n\r\n**To Reproduce**\r\n\r\n1. Run the 'UTBotJava' project in IntelliJ Idea\r\n2. Install [plugin build](https://github.com/UnitTestBot/UTBotJava/actions/runs/3296912146) or one of the latest builds from main. [Reproducing on more early build too](https://github.com/UnitTestBot/UTBotJava/actions/runs/3282086137)\r\n3. Generate tests for utbot-sample/src/main/java/org/utbot/examples/enums\r\nwith No mocks, No parameterization.\r\n4. Run the generated tests\r\n\r\n**Expected behavior**\r\n\r\nAssertions in generated tests are supposed to pass.\r\n\r\n**Actual behavior**\r\n\r\nThere are assertion errors in tests - for every class in the package.\r\nPlease see the Class creation: `State$3` is addressing not the State enum, but the third constant in it.\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\n\r\n~~~java\r\n ///region Test suites for executable org.utbot.examples.enums.ComplexEnumExamples.findState\r\n\r\n ///region FUZZER: SUCCESSFUL EXECUTIONS for method findState(int)\r\n\r\n @Test\r\n @DisplayName(\"findState: code \u003e 0\")\r\n public void testFindState() throws ClassNotFoundException, IllegalAccessException {\r\n ComplexEnumExamples complexEnumExamples = new ComplexEnumExamples();\r\n\r\n State actual = complexEnumExamples.findState(1);\r\n\r\n Class anonymousStateClazz = Class.forName(\"org.utbot.examples.enums.State$3\");\r\n Object expected = getEnumConstantByName(anonymousStateClazz, \"UNKNOWN\");\r\n assertEquals(expected, actual);\r\n }\r\n~~~\r\n\r\nsame for Symbolic execution:\r\n\r\n```java\r\n ///region Test suites for executable org.utbot.examples.enums.State.findStateByCode\r\n\r\n ///region SYMBOLIC EXECUTION: SUCCESSFUL EXECUTIONS for method findStateByCode(int)\r\n\r\n /**\r\n * @utbot.classUnderTest {@link State}\r\n * @utbot.methodUnderTest {@link State#findStateByCode(int)}\r\n */\r\n @Test\r\n @DisplayName(\"findStateByCode: \")\r\n public void testFindStateByCode() throws ClassNotFoundException, IllegalAccessException {\r\n State actual = State.findStateByCode(255);\r\n\r\n Class anonymousStateClazz = Class.forName(\"org.utbot.examples.enums.State$1\");\r\n Object expected = getEnumConstantByName(anonymousStateClazz, \"OPEN\");\r\n assertEquals(expected, actual);\r\n }\r\n\r\n```\r\n\r\n**Additional context**\r\n\r\nSame issue with Fuzzing and / or Symbolic execution.\r\nThese tests are also failing when running in debug IDEA with runIde.\r\n","author":{"url":"https://github.com/alisevych","@type":"Person","name":"alisevych"},"datePublished":"2022-10-21T13:15:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1210/UTBotJava/issues/1210"}
| 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:07ef382a-ef34-f4dd-d401-c2dfd82f92fd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA04:E9CC5:3B439D:4C8728:6990DA7B |
| html-safe-nonce | 0ef4a2533fabc8983010cd9fbf949bb7942bf785ada1429a35a118ffda97850a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTA0OkU5Q0M1OjNCNDM5RDo0Qzg3Mjg6Njk5MERBN0IiLCJ2aXNpdG9yX2lkIjoiMzg2OTIwODMyMzU4OTk4NjkzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 06b2fbb4b68074825d5103858af673a684d98011a57b0f6621f5f47dea394d20 |
| hovercard-subject-tag | issue:1418327330 |
| 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/1210/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2728703c8cf1b4212eac7781e3a1ce10385c73c6dd4cc4d09fb0c20e20b63e17/UnitTestBot/UTBotJava/issues/1210 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2728703c8cf1b4212eac7781e3a1ce10385c73c6dd4cc4d09fb0c20e20b63e17/UnitTestBot/UTBotJava/issues/1210 |
| og:image:alt | Description When Enum class is created by className, it addresses not class but the Enum constant. To Reproduce Run the 'UTBotJava' project in IntelliJ Idea Install plugin build or one of the lates... |
| 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 | 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 | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width