'Mocking scope function in Kotlin
I am using following object creation methods in kotlin
class Resource(
referenceFactory: ReferenceFactory,
id: String,
name: String,
role: String,
odi_runs: int,
odi_wickets: int,
test_runs: int,
test_wickets: int){
referenceFactory.calculateRank(Player().apply {
id = id
name = name
role = role
odi_runs = odi_runs
odi_wicket = odi_wickets
test_runs = test_runs
test_wicket = test_wicket
})
}
then I use this created object for calculate the rank of the player. To get the valid test result from reference factory, I need to mock this 'Player' object creating scope method.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|