Skip to content

no-op behavior for Junit classes [SPR-3264] #7949

@spring-projects-issues

Description

@spring-projects-issues

Costin Leau opened SPR-3264 and commented

If the current test classes provided in Spring have to be reused (as we do in Spring/OSGi), there are a few bumps which make extension hard.

One particular problem occurs in AbstractSingleSpringContextTests and AbstractDependencyInjectionSpringContextTests. The first class always expects an application context to be created even if no files/locations are specified which can lead to NPE problems or force an appCtx to be instantiated even if not needed.
Even if the first problem can be overcome, the second test will try to apply auto-injection; this can be disabled but it has to be done manually inside the onSetUp...

Basicaly, it would be nice to have a no-op behavior; if nothing is supplied then the functionality inside the test is not applied. Again this makes sense, if the test is used as a base class. Another solution would be to move some of the functionality outside the test class so new hierachies don't have to extend this one. However, this doesn't add a lot of benefits since in most cases, the functionality has to be applied on the test itself.


Issue Links:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions