Skip to content

Create @Tested objects before test setup (@Before, @BeforeMethod) methods #122

@rliesenfeld

Description

@rliesenfeld

Leaving @tested fields null for test setup methods can confuse users, as they expect them to be initialized together with mock fields. On the other hand, doing so would prevent the pre-recording of expectations that may be needed by the constructor of the tested class, or by a @PostConstruct/init method. It would also create ambiguities for test methods having @Injectable parameters.

The only reasonable choice I see is to add an optional boolean attribute to @tested, to let the user request that such objects be initialized before any test setup method.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions