Q:

How can I mock HttpResponse, an interface, with RETURNS_DEEP_STUBS

I want to return 200 when these functions are called:
`when`(httpResponse.statusLine.statusCode).thenReturn(200)

the httpResponse is a mock created by 
val httpResponse = mock(HttpResponse::class.java, RETURNS_DEEP_STUBS)

My problem is that httpResponse is null when I use RETURNS_DEEP_STUBS. I guess this happens because HttpResponse is an interface(?). 
If I skip RETURNS_DEEP_STUBS, i cant call any functions after the first statusLine 
Is it possbile to mock an interface like this? If so how?

A:

Just create another mock:
val httpResponseStub = mock(HttpResponse::class.java);
val statusLineStub= mock(StatusLine::class.java);

when(statusLineStub.statusCode).thenReturn(200);
when(httpResponseStub.statusLine).thenReturn(statusLineStub);

step by step.

