I have a final class, something like this:
public final class RainOnTrees{
public void startRain(){
// some code here
}
}
I
I think you need think more in principle. Instead you final class use his interface and mock interface instead.
For this:
public class RainOnTrees{
fun startRain():Observable{
// some code here
}
}
add
interface iRainOnTrees{
public void startRain():Observable
}
and mock you interface:
@Before
fun setUp() {
rainService= Mockito.mock(iRainOnTrees::class.java)
`when`(rainService.startRain()).thenReturn(
just(true).delay(3, TimeUnit.SECONDS)
)
}