Joram Visser
02/16/2019, 7:09 PMoleksiyp
02/16/2019, 7:32 PMJoram Visser
02/16/2019, 9:45 PMsuspend inline fun <reified T : Any> MongoCollection<T>.getOneById(id: ObjectId): Either<MongoError, T> {
val filter = idFilterQuery(id)
return try {
val resultEntity = this.find(filter).awaitFirstOrNull()
when {
resultEntity != null -> right(resultEntity)
else -> left(ENTITY_NOT_FOUND)
}
} catch (e: Exception) {
left(ERROR)
}
}
Does it mean that I can not call the above function from another class/function and reply with a mocked version.
Does it also mean I won’t be able to call this function in a test case and mock the calls that are made within this inline function?LeoColman
02/16/2019, 11:42 PMJoram Visser
02/17/2019, 3:53 PM