Title: Fuzzer should change objects with its public setters by Markoutte · Pull Request #439 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Fuzzer should change objects with its public setters by Markoutte · Pull Request #439 · UnitTestBot/UTBotJava
X Title: Fuzzer should change objects with its public setters by Markoutte · Pull Request #439 · UnitTestBot/UTBotJava
Description: Description Fuzzing now can create object with empty constructor and change that object with public field or field setter if exists. Setter can have any return type but must have corresponding getter. Fixes #289 Type of Change New feature (non-breaking change which adds functionality) How Has This Been Tested? Automated Testing org.utbot.framework.plugin.api.ModelProviderTest#test complex object is created with setters Manual Scenario Try to generate test for method equalsTo from this class: public class MyJavaObject { public static int pubStaticField; public final int pubFinalField = 0; public int pubField; public int pubFieldWithSetter; private int prvField; private int prvFieldWithSetter; public int getPubFieldWithSetter() { return pubFieldWithSetter; } public void setPubFieldWithSetter(int pubFieldWithSetter) { this.pubFieldWithSetter = pubFieldWithSetter; } public int getPrvFieldWithSetter() { return prvFieldWithSetter; } public void setPrvFieldWithSetter(int prvFieldWithSetter) { this.prvFieldWithSetter = prvFieldWithSetter; } public boolean equalsTo(MyJavaObject o) { if (o.prvField > 0) {} if (this == o) return true; if (pubStaticField != o.pubStaticField) return false; if (pubFinalField != o.pubFinalField) return false; if (pubField != o.pubField) return false; if (pubFieldWithSetter != o.pubFieldWithSetter) return false; if (prvField != o.prvField) return false; if (prvFieldWithSetter != o.prvFieldWithSetter) return false; return true; } } Example of result test: @Test @DisplayName("equalsTo: o = MyJavaObject() -> return true") public void testEqualsToReturnsTrue() { MyJavaObject myJavaObject = new MyJavaObject(); MyJavaObject myJavaObject1 = new MyJavaObject(); myJavaObject1.pubField = 0; myJavaObject1.setPubFieldWithSetter(0); myJavaObject1.setPrvFieldWithSetter(0); boolean actual = myJavaObject.equalsTo(myJavaObject1); assertTrue(actual); } Checklist (remove irrelevant options): The change followed the style guidelines of the UTBot project Self-review of the code is passed The change contains enough commentaries, particularly in hard-to-understand areas New documentation is provided or existed one is altered No new warnings All tests pass locally with my changes
Open Graph Description: Description Fuzzing now can create object with empty constructor and change that object with public field or field setter if exists. Setter can have any return type but must have corresponding gett...
X Description: Description Fuzzing now can create object with empty constructor and change that object with public field or field setter if exists. Setter can have any return type but must have corresponding gett...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/pull/439
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:d3f26d47-f061-3dc7-a9ac-6fedc8d13444 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8B7C:189FB3:87FA46:B0FA08:698FB942 |
| html-safe-nonce | e3b7784afd178cac50554d141b73ca26cd2f13025ae140ac99a9f9e2b212c4a6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjdDOjE4OUZCMzo4N0ZBNDY6QjBGQTA4OjY5OEZCOTQyIiwidmlzaXRvcl9pZCI6IjMwNzU2MjEyNTQ4OTMzODYwNTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bb6a83d0d27c72c46bd39cf6851a3dcb8520b8f0f6096605e600abe580cd1ea0 |
| hovercard-subject-tag | pull_request:988759400 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/UnitTestBot/UTBotJava/pull/439/files |
| twitter:image | https://avatars.githubusercontent.com/u/720952?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/720952?s=400&v=4 |
| og:image:alt | Description Fuzzing now can create object with empty constructor and change that object with public field or field setter if exists. Setter can have any return type but must have corresponding gett... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4084c47bba08e7ba5fab63cb1dd485a339910ed7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width