Closed JHahnHRO closed 2 years ago
Also note that
master
is now CDI 4/Weld 5 so if you need this for weld-junit 3 (Weld 4) we will need to backport it.
Yes, I want to backport it to 3.x and preferably even 2.x. But I thought I should wait with PRs for additional branches until the PR to master is accepted.
Yes, I want to backport it to 3.x and preferably even 2.x. But I thought I should wait with PRs for additional branches until the PR to master is accepted.
3.x is fine and I will backport it there. That branch will get a release once Spock PRs are addressed. However, 2.x isn't actively developed and there is no release plan for it so I don't see much point in backporting there.
However, 2.x isn't actively developed and there is no release plan for it so I don't see much point in backporting there.
There are still quite a few projects in active development that use javax, for example all Quarkus applications (for now at least). Those will need the javax-Version of Weld for testing (in Quarkus' case because there is no similar testing support for Arc). On the other hand, this is not the most important feature ever, so I guess I can live without it.
Is it expected / intended, that this PR breaks existing tests?
Before this PR it was perfectly fine to have @WeldSetup Object foo = WeldInitiator.of(Foo.class)
now this would fail as no longer the value type is checked, but now the field type is checked.
Is it expected / intended, that this PR breaks existing tests? Before this PR it was perfectly fine to have
@WeldSetup Object foo = WeldInitiator.of(Foo.class)
now this would fail as no longer the value type is checked, but now the field type is checked.
Definitely not intended but it looks like we didn't have tests for that (not that I would expect people to store it in Object
although I see no reason to forbid it).
Looks like this is the offending bit, right?
Previously, we instead checked if the field value is instanceof WeldInitiator
and casted to it.
We should probably keep that.
Exactly
I incorporated the logic revert in my other PR where I had other Jupiter module improvements too.
Thanks!
Will resolve #129 by modifying the search for
@WeldSetup WeldInitiator
fields so that@Nested
test instances are searched first, then their enclosing instance, then their enclosing instance etc. until an Initiator is found. This way, nested test classes can re-use their parent's configuration by doing nothing and overwrite their parent's configuration by defining their own@WeldSetup WeldInitiator
field.