Skip to content
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

[Spring] Inject CucumberContextConfiguration constructor dependencies #2664

Merged

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Dec 16, 2022

πŸ€” What's changed?

In #2661 classes annotated with @CucumberContextConfiguration were created as beans directly from the bean factory. This allowed them to be prepared as test instances by JUnit. However, we did not tell the factory that it should autowire constructor dependencies resulting in #2663.

Additionally, because beans were created directly from the bean factory, they were not added to the application context. This meant that while dependencies could be injected into them, they could not be injected into other objects.

Fixes: #2663

🏷️ What kind of change is this?

  • πŸ› Bug fix (non-breaking change which fixes a defect)

πŸ“‹ Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@mpkorstanje mpkorstanje force-pushed the spring-inject-cucumber-context-configuration-dependencies branch from 4b8d712 to 13f319f Compare December 16, 2022 13:33
@mpkorstanje mpkorstanje marked this pull request as ready for review December 16, 2022 13:33
In #2661 classes annotated with `@CucumberContextConfiguration` were created as
beans directly from the bean factory. This allowed them to be prepared as test
instances by JUnit. However, we did not tell the factory that it should
autowire constructor dependencies resulting in #2663.

Additionally, because beans were created directly from the bean factory, they
were not added to the application context. This meant that while dependencies
could be injected into them, they could not be injected into other objects.

Fixes: #2663
@mpkorstanje mpkorstanje force-pushed the spring-inject-cucumber-context-configuration-dependencies branch from 13f319f to 1a55e41 Compare December 16, 2022 13:39
@codecov
Copy link

codecov bot commented Dec 16, 2022

Codecov Report

Merging #2664 (13f319f) into main (fe2d667) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 13f319f differs from pull request most recent head 1a55e41. Consider uploading reports for the commit 1a55e41 to get more accurate results

@@            Coverage Diff            @@
##               main    #2664   +/-   ##
=========================================
  Coverage     84.81%   84.82%           
  Complexity     2693     2693           
=========================================
  Files           322      322           
  Lines          9570     9573    +3     
  Branches        905      905           
=========================================
+ Hits           8117     8120    +3     
  Misses         1121     1121           
  Partials        332      332           
Impacted Files Coverage Ξ”
...in/java/io/cucumber/spring/TestContextAdaptor.java 93.80% <100.00%> (+0.16%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mpkorstanje mpkorstanje merged commit 0f2b83c into main Dec 16, 2022
@mpkorstanje mpkorstanje deleted the spring-inject-cucumber-context-configuration-dependencies branch December 16, 2022 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No default constructor
1 participant