Code example for MockContext

0
import com.google.android.testing.mocking.AndroidMock; 
 
public class RequestProxyImplTest extends AbstractTest { 
 
    public void testSendRequest() throws Exception { 
        Context context = new MockContext();
        SendRequestParams params = new SendRequestParams(
                "body1", 
                new String[] {"r1", "r2"},
                "url1", 
                "mobileUrl1", 
                "image1"); 
        SendRequestCallbackHandler handler = new SendRequestCallbackHandler(context);
        Map<String, String> parameterMap = params.convertParameterMap();
         
        MixiContainer mixiContainer = AndroidMock.createMock(MixiContainer.class);
        mixiContainer.showDialog(context, "/requests", parameterMap, handler);
        AndroidMock.replay(mixiContainer);
         
        RequestProxyImpl target = new RequestProxyImpl(mixiContainer);
        target.sendRequest(context, params, handler);
         
        AndroidMock.verify(mixiContainer);
    } 
     
    public void testDeleteRequests() throws Exception {