getBeans

open fun <T> getBeans(type: Class<T>): MapAssert<String, T>

Obtain a map bean names and instances of the given type from the application context (or ancestors), the map becoming the object under test. If no bean of the specified type can be found an assert on an empty map is returned.

Example:

	assertThat(context).getBeans(Foo.class).containsKey("foo");
	

Return

bean assertions for the beans, or an assert on an empty map if theno beans are found

Parameters

<T>

the bean type

type

the bean type

Throws

if the application context did not start


open fun <T> getBeans(type: Class<T>, scope: ApplicationContextAssert.Scope): MapAssert<String, T>

Obtain a map bean names and instances of the given type from the application context, the map becoming the object under test. If no bean of the specified type can be found an assert on an empty map is returned.

Example:

	assertThat(context).getBeans(Foo.class, Scope.NO_ANCESTORS).containsKey("foo");
	

Return

bean assertions for the beans, or an assert on an empty map if theno beans are found

Parameters

<T>

the bean type

type

the bean type

scope

the scope of the assertion

Throws

if the application context did not start