Creates a dynamic test expecting an error of a specific type.
This DSL instance for method chaining.
The type of the expected error.
The KClass of the expected error type.