Skip to content

@CheckReturnValue decoration for ApplicationContextAssert::getBean(s) methods #32683

@scordio

Description

@scordio

I suggest to decorate ApplicationContextAssert::getBean(s) methods with a @CheckReturnValue annotation so that incomplete statements like the following are spotted by static analysis tools like SpotBugs and IntelliJ IDEA:

assertThat(context).getBean(MyService.class);

To achieve this, no additional dependency is needed and Spring Boot Test can declare its own @CheckReturnValue annotation, similarly to what AssertJ and Mockito do.

I can raise a PR with the changes if the idea is accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions