In Kotlin the powerful construct of delegation can be used to extend functionality of existing interfaces by reusing existing implementations.
class Demo : Map by HashMap {}
Questions:
- What should I be testing? Testing hashmap from the example is not the target of this test. It seems very verbose to verify the complete implementation, I would rather like to verify that the delegation of the proper fields take place.
- When using mutation testing, e.g. using PItest, how do I catch all mutations? The report shows quite a few mutations, correctly I believe. The Kotlin compiler creates byte code for all delegations.