Code example for MockContext

0
 
    private GetIdCallbackHandler target;
     
    @Override 
    protected void setUp() { 
        target = new GetIdCallbackHandler(new MockContext());
    } 
     
    @Override 
    protected void tearDown() { 
        target = null;
    } 
     
    public void testSimple() throws Exception { 
        String json = "{\"id\":\"id1\"}";
        Bundle bundle = new Bundle();
        bundle.putString("response", json);
         
        target.onComplete(bundle);
         
        String id = target.getId();