hasSingleBean
Verifies that the application context (or ancestors) contains a single bean with the given type.
Example:
assertThat(context).hasSingleBean(Foo.class);
Content copied to clipboard
Return
this
assertion object.
Parameters
type
the bean type
Throws
if the application context contains multiple beans of thegiven type
open fun hasSingleBean(type: Class<out Any>, scope: ApplicationContextAssert.Scope): ApplicationContextAssert<C>
Verifies that the application context contains a single bean with the given type.
Example:
assertThat(context).hasSingleBean(Foo.class, Scope.NO_ANCESTORS);
Content copied to clipboard
Return
this
assertion object.
Parameters
type
the bean type
scope
the scope of the assertion
Throws
if the application context contains multiple beans of thegiven type