Reputation: 3694
What is a clean way to get a list of all my custom test method annotations of all to-be-executed test methods in a Jupiter BeforeAllCallback Extension?
The Extension shall collect setup data from these custom annotations on the test methods, and prepare the integration test before any of the test methods runs.
Before Jupiter 5.4, we had an ugly workaround in place to retrieve it via reflection from the ClassExtensionContext, set method "getTestDescriptor" accessible, and calling getChildren() on it. The returned set of TestMethodTestDescriptors will allow to collect our custom annotations...
Since Jupiter 5.4, ClassExtensionContext is package-private, and I would have to move my Extension to this very package org.junit.jupiter.engine.descriptor
too, which would further uglify the workaround...
Upvotes: 0
Views: 522