class DownCastBuilder<T : Any, TSub : T> : IDownCastBuilder<T, TSub>
A builder for creating a down-casting assertion.
Or in other words, helps to make an assertion about IAssertionPlant.subject of type T that it can be down-casted to subType of type TSub.
T - The type of IAssertionPlant.subject.
TSub - The type to which IAssertionPlant.subject can be down-casted, hence needs to be a subtype of T.
DownCastBuilder(description: ITranslatable, subType: KClass<TSub>, commonFields: CommonFields<T?>) |
fun cast(): IAssertionPlant<TSub>
Performs the down-cast if possible; reports a failure otherwise. |
|
fun withLazyAssertions(createAssertions: IAssertionPlant<TSub>.() -> Unit): IDownCastBuilder<T, TSub>
Use this method if you want to add several assertions which are checked lazily after the down cast is performed. |
|
fun withNullRepresentation(representation: String): IDownCastBuilder<T, TSub>fun withNullRepresentation(translatableRepresentation: ITranslatable): IDownCastBuilder<T, TSub>
Use this method if you want to use your own |