Title: Summaries are not generated for methods from nested classes of nested classes · Issue #710 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Summaries are not generated for methods from nested classes of nested classes · Issue #710 · UnitTestBot/UTBotJava
X Title: Summaries are not generated for methods from nested classes of nested classes · Issue #710 · UnitTestBot/UTBotJava
Description: Description If we have a chain of at least three classes nested in each other (like class A { class B { class C { int f(); } } } ), summaries are not generated for the functions of the innermost of them (A.B.C.f() in our example). To Rep...
Open Graph Description: Description If we have a chain of at least three classes nested in each other (like class A { class B { class C { int f(); } } } ), summaries are not generated for the functions of the innermost of...
X Description: Description If we have a chain of at least three classes nested in each other (like class A { class B { class C { int f(); } } } ), summaries are not generated for the functions of the innermost of...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/710
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Summaries are not generated for methods from nested classes of nested classes","articleBody":"**Description**\r\n\r\nIf we have a chain of at least three classes nested in each other (like `class A { class B { class C { int f(); } } }` ), summaries are not generated for the functions of the innermost of them (`A.B.C.f()` in our example).\r\n\r\n**To Reproduce**\r\n\r\n**UPD.** Nested classes are now supported in plugin, so the behavior can be reproduced just by launching plugin on the below class\r\n\r\nAs nested classes are currently supported only in contest estimator, the easiest way to reproduce the bug is through tests:\r\n\r\n1. Add file `DeepNested.java` into `utbot-sample/src/main/java/org/utbot/examples/inner/` with the following content:\r\n\r\n```Java\r\npackage org.utbot.examples.inner;\r\n\r\npublic class DeepNested {\r\n public class Nested1 {\r\n public class Nested2 {\r\n public int f() {\r\n return 0;\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\n2. Add file `DeepNestedTest.kt` into `utbot-summary-tests/src/test/kotlin/examples/inner/` with the following content:\r\n\r\n```Kotlin\r\npackage examples.inner\r\n\r\nimport examples.SummaryTestCaseGeneratorTest\r\nimport org.junit.jupiter.api.Test\r\nimport org.utbot.examples.DoNotCalculate\r\nimport org.utbot.examples.inner.DeepNested\r\nimport org.utbot.framework.plugin.api.MockStrategyApi\r\n\r\nclass DeepNestedTest : SummaryTestCaseGeneratorTest(\r\n DeepNested::class,\r\n) {\r\n @Test\r\n fun testF() {\r\n val summary1 = \"Test returns from: return 0;\"\r\n\r\n val method = DeepNested.Nested1.Nested2::f\r\n val mockStrategy = MockStrategyApi.NO_MOCKS\r\n val coverage = DoNotCalculate\r\n\r\n val summaryKeys = listOf(\r\n summary1\r\n )\r\n\r\n summaryCheck(method, mockStrategy, coverage, summaryKeys)\r\n }\r\n}\r\n```\r\n\r\n**Expected behavior**\r\n\r\nTest passes, as corresponding summaries are generated for tests for `A.B.C.f()`\r\n\r\n**Actual behavior**\r\n\r\nTest fails because no summaries are generated.\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\n\r\nTest fails with assertion message\r\n\r\n```\r\nThe following comments were produced by the UTBot, but were not found in the list of comments passed in the check() method:\r\n\r\n-------------------------------------------------------------\r\n\r\nnull-------------------------------------------------------------\r\n\r\n\r\nThe following comments were passed in the check() method, but were not found in the list of comments produced by the UTBot:\r\n\r\n-------------------------------------------------------------\r\n\r\nTest returns from: return 0;\r\n-------------------------------------------------------------\r\n```\r\n\r\n\r\n\r\n**Environment**\r\n\r\nNothing specific.\r\n\r\n**Additional context**\r\n\r\nFor me it seems that problem is in `org.utbot.summary.ast.SourceCodeParser#traverseInnerClassDeclarations` and the fact that it doesn't make any recursive calls.\r\n","author":{"url":"https://github.com/volivan239","@type":"Person","name":"volivan239"},"datePublished":"2022-08-11T10:24:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/710/UTBotJava/issues/710"}
| 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:2d081808-0fd2-1618-d792-933d1ca2cf6b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DCA8:C4F19:11BD153:16752B3:69902CCB |
| html-safe-nonce | bc45e31574256c1ce688e2c2070f0b3736ad5d46f2dd36f546344842e37933d0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQ0E4OkM0RjE5OjExQkQxNTM6MTY3NTJCMzo2OTkwMkNDQiIsInZpc2l0b3JfaWQiOiI2MzQ2Mjk4OTYzMTU5NjkwNDQzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 58b2e4915889e05d008be971145de86151c8b02264f9d45e53797fd1cd649325 |
| hovercard-subject-tag | issue:1335762369 |
| 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/710/issue_layout |
| twitter:image | https://opengraph.githubassets.com/784e66cf66afaa73ae86c40ec2f97556190f58e1cb45f429c51136102b25d606/UnitTestBot/UTBotJava/issues/710 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/784e66cf66afaa73ae86c40ec2f97556190f58e1cb45f429c51136102b25d606/UnitTestBot/UTBotJava/issues/710 |
| og:image:alt | Description If we have a chain of at least three classes nested in each other (like class A { class B { class C { int f(); } } } ), summaries are not generated for the functions of the innermost of... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | volivan239 |
| 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