Open
Description
We are implementing two companion extensions. Configuring them is complicated enough that we use the programmatic @RegisterExtension
.
The extensions are usable separately, or together. When used together, one must always be initialized before the other.
Currently, seemingly the only way to do this is:
class Extension1 implements BeforeAllCallback { ... }
class Extension2 implements BeforeAllCallback { ... }
class TestCase {
@RegisterExtension
@Order(1)
static Extension1 e1 = new Extension1();
@RegisterExtension
@Order(2)
static Extension2 e2 = new Extension2();
}
We'd like to provide a sensible default so that users don't have to think about this:
@Order(1)
class Extension1 implements BeforeAllCallback { ... }
@Order(2)
class Extension2 implements BeforeAllCallback { ... }
class TestCase {
@RegisterExtension
static Extension1 e1 = new Extension1();
@RegisterExtension
static Extension2 e2 = new Extension2();
}
Right now this seems to not be possible. It looks like a straightforward improvement to ExtensionUtils.getOrder(Field)
to consider first the field, then the field's type, then the default.
Did I miss some easier way to accomplish this? Thanks!