# withType

abstract fun <S> withType(type: Class<S>): ModelMap<S>(source)

Returns a collection containing the items from this collection which are of the specified type.

#### Return

The collection.

#### Since

2.5

#### Parameters

type

The type.

<S>

The type.

abstract fun <S> withType(type: Class<S>, configAction: Action<in S>)(source)

Applies the given action to each item of the given type in the collection, as each item is required.

The given action is invoked to configure the item when the item is required. It is called after any actions provided to beforeEach and create.

#### Since

2.5

#### Parameters

type

The type of elements to apply the action to.

configAction

An action that configures the item. The action is executed when the item is required.

abstract fun <S> withType(type: Class<S>, rules: Class<out RuleSource>)(source)

Applies the given rules to all items of the collection of the given type.

#### Since

2.5

#### Parameters

type

the type that the item must be/implement to have the rules applied

rules

rules to apply