Skip to content

Conversation

@tepa46
Copy link
Collaborator

@tepa46 tepa46 commented Jul 24, 2023

Description

Engine can reproduce one or two UtModels on two @Autowired variables of the same type.

In PR #2421 only the option with two UtModels is considered.

Now Spring unit tests can autowire two different beans of one type and one UtModel.

If all test executions use only one autowired bean of some class, then we can mock this variable by @mock annotation,
else we need to use simple mock.

How to test

Automated tests

ServiceOfBeansWithSameTypeTest is a set of newly created autotests for this feature

Manual tests

Tested cases:

  1. the Engine produces two UtModels on two @Autowired variables of the same type
  2. the Engine produces one UtModel on two @Autowired variables of the same type
  3. one @Autowired variable is created for each type

Scenarios for testing 1) and 2) cases can be viewed in twoAndMoreBeansForOneType/ServiceOfBeansWithSameTypeTest.java in the module utbot-spring-sample

Self-check list

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

tepa46 added 3 commits July 21, 2023 15:01
…ine output one model for variables of one type.
…Autowired variables of the same type, 2) the Engine reproduces one model on two @Autowired variables of the same type
@tepa46 tepa46 added comp-codegen Issue is related to code generator comp-spring Issue is related to Spring projects support labels Jul 24, 2023
@tepa46 tepa46 added this to the Spring Phase 4 milestone Jul 24, 2023
@tepa46 tepa46 requested a review from EgorkaKulikov July 24, 2023 08:33
Copy link
Collaborator

@EgorkaKulikov EgorkaKulikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix two comments that I left. please. After that you may merge pull request without additional review.

@EgorkaKulikov EgorkaKulikov merged commit 051b293 into main Jul 25, 2023
@EgorkaKulikov EgorkaKulikov deleted the kirill/support-two-beans-of-one-type branch July 25, 2023 12:28
@alisevych alisevych removed this from the Spring Phase 4 milestone Jul 26, 2023
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

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants