-
Notifications
You must be signed in to change notification settings - Fork 15
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
Inject ZPT related fields into superclasses #605
Conversation
The extensions should inject the ZeebeClient and the ZeebeTestEngine into the fields available with this type. This test will verify that this happens for both the embedded engine and the testcontainers engine.
The extensions should inject the engine, client and recordstream into the fields that are available. Before this only tried to inject them into the annotated class. This does not work when inheritance is used and the fields are defined on the superclass of the annotated class. This commit changes the extension so that it will first look on the annotated class. If it cannot find any of the annotations here, it will work it's way up to the superclass and so on until it either found a field it is able to inject, or no fields at all.
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.
LGTM! 🚀
@remcowesterhoud thanks for passing the review to me. It was a nice chance to learn how the extension works.
I raised one point for discussion below, so this is why I didn't ask bors to merge the PR. It's optional, so fell free to merge it if you want to.
} else if (fields.size() == 0) { | ||
final Class<?> superclass = requiredTestClass.getSuperclass(); | ||
return superclass == null ? Optional.empty() : getField(superclass, object); | ||
} else { | ||
return Optional.of(fields.get(0)); |
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.
👍 Nice, it will go up in the hierarchy until if finds something.
.../test/java/io/camunda/zeebe/process/test/qa/embedded/injection/InheritanceInjectionTest.java
Show resolved
Hide resolved
bors merge |
Build succeeded: |
Successfully created backport PR #608 for |
Successfully created backport PR #609 for |
Description
The extensions should inject the engine, client and recordstream into the fields that are available. Before this only tried to inject them into the annotated class. This does not work when inheritance is used and the fields are defined on the superclass of the annotated class.
This PR changes the extensions so that it will first look on the annotated class. If it cannot find any of the annotations here, it will work it's way up to the superclass and so on until it either found a field it is able to inject, or no fields at all.
Related issues
closes #604
Definition of Done
Not all items need to be done depending on the issue and the pull request.
Code changes:
Testing:
Documentation: