RestClient.getInstance().getAllLeads(6, new RestCallback<HashMap<String, Object>>(LeadsHttpAdapter.class) {
@Override
public void failure(RestError restError) {
}
@Override
public void restSuccess(Object o) {
ArrayList<Lead> LeadCardsList = (ArrayList) o;
LeadsListAdapter leadsListAdapter = new LeadsListAdapter(getActivity(), LeadCardsList);
LeadsListView.setAdapter(leadsListAdapter);
LeadsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(getActivity(), LeadOfferDetails.class);
startActivity(intent);
}
});
}
});
This is written in my activity class function , I pass the RestClient as a parameter to that function so while unit testing the function i pass the mocked client . How do i test the callback , since by the time callback gets called my test function comes out of scope.