How can I test this method isOpenOrClosed
the when condition, i cannot mock it easily, because there is no method to test.I want to verify some condition for instance a status 2 and see that returns IamAnEnumWithTwoStatesOpenORCLoses.CLOSED
val statusType: ReturnASealedClass
get() = when (statusIsAnIntFrom1To9FromTheApi) {
1 -> ChildObject1
2 -> ChildObject2
3 -> ChildObject3
4 -> ChildObject4
5 -> ChildObject5
6 -> ChildObject6
7 -> ChildObject7
8 -> ChildObject8
9 -> ChildObject9
else -> throw IllegalStateException("Status not supported")
}
val isOpenOrClosed
get() = when (statusType) {
ChildObject1,//All these Object inherit from FatherObject
ChildObject2
ChildObject3 -> IamAnEnumWithTwoStatesOpenORCLoses.CLOSED
else -> IamAnEnumWithTwoStatesOpenORCLoses.OPEN
}
Aucun commentaire:
Enregistrer un commentaire