Class StubFieldsSupport

java.lang.Object
ru.vyarus.dropwizard.guice.test.jupiter.env.field.AnnotatedTestFieldSetup<StubBean,Object>
ru.vyarus.dropwizard.guice.test.jupiter.ext.stub.StubFieldsSupport
All Implemented Interfaces:
TestExecutionListener, TestEnvironmentSetup

public class StubFieldsSupport extends AnnotatedTestFieldSetup<StubBean,Object>
StubBean test fields support implementation.

Annotated fields resolved in time of guicey extension initialization (beforeAll or beforeEach). Register override bindings for provided stubs (singletons!). Stub instances created by guice (to be able to use injections inside it). If stub field is initialized manually - this value would be bound into guice context (see debug report to be sure what value was actually used - field might be assigned too late).

In beforeAll injects static values, in beforeEach inject both (in case if beforeAll wasn't called).

For stub objects, implementing StubLifecycle before and after methods called on beforeEach and afterEach to perform cleanups.

Since:
07.02.2025