-
Notifications
You must be signed in to change notification settings - Fork 46
Support autowiring collections in Spring Unit tests #2473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
...ain/kotlin/org/utbot/framework/codegen/domain/models/builders/SpringTestClassModelBuilder.kt
Outdated
Show resolved
Hide resolved
.filterTo(mutableSetOf()) { cgModel -> | ||
cgModel.model.canBeSpied() && cgModel !in thisInstanceModels | ||
} | ||
|
||
val autowiredFromContextModels = | ||
stateBeforeDependentModels.filterTo(HashSet()) { it.model.isAutowiredFromContext() } | ||
|
||
return SpringSpecificInformation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we should create a constructor of SpringSpecificInformation
that groups by classId itself and here just write
SpringSpecificInformation(thisInstanceModels, dependentMockModels, dependentSpyModels, autowiredFromContextModels)
...mework/src/main/kotlin/org/utbot/framework/codegen/services/framework/SpyFrameworkManager.kt
Show resolved
Hide resolved
...ork/src/main/kotlin/org/utbot/framework/codegen/tree/CgAbstractSpringTestClassConstructor.kt
Outdated
Show resolved
Hide resolved
utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgClassFieldManager.kt
Outdated
Show resolved
Hide resolved
utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgClassFieldManager.kt
Outdated
Show resolved
Hide resolved
utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgClassFieldManager.kt
Outdated
Show resolved
Hide resolved
utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgClassFieldManager.kt
Outdated
Show resolved
Hide resolved
EgorkaKulikov
approved these changes
Aug 3, 2023
This was referenced Aug 3, 2023
EgorkaKulikov
pushed a commit
that referenced
this pull request
Aug 4, 2023
IlyaMuravjov
added a commit
that referenced
this pull request
Aug 4, 2023
EgorkaKulikov
pushed a commit
that referenced
this pull request
Aug 7, 2023
* Support creation and persistence of valid entities * Make `GeneratedFieldValueProvider` be aware of entity class and not just field declaring class * Introduce `PreservableFuzzedTypeProperty` * Make so `persist()` and `detach()` modifications are always applied for MANAGED and DETACHED entities * Actualize `HandlerClassesLoader.loadClass` javadoc * Introduce value replacement for common collection types in `UtModelConstructor` * Make minimization encourage use of non-hardcoded values * Improve valid value providers * Add `@WithMockUser` in concrete execution and code generation * Fix compilation after rebase * Fix inconsistent naming after rebase * Fix inconsistent naming after one more rebase * Fix `stateBeforeDependentModels` after #2473 * Make `getDependenciesForBean` actually use `analyzedBeanNames` * Add `@WithMockUser` in code generation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
comp-codegen
Issue is related to code generator
comp-spring
Issue is related to Spring projects support
ctg-enhancement
New feature, improvement or change request
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #2436
Add supporting autowiring collections by
Spy
annotation in Spring Unit tests.The class under test:
Generated test:
How to test
Manual tests
Manual tested cases:
Self-check list