How to mock application context

Viewed 15101

How do we mock an Application Context? I got a presenter which I intend to write a test for. The parameters it receives were a view and Context. How do I create a mock for context to work?

public TutorProfilePresenter(TutorProfileScreenView view, Context context){
     this.view = view;
     this.context = context
}
            
public void setPrice(float price,int selectedTopics){
      int topicsPrice = 0;
      if(selectedTopics>2)
      {
        topicsPrice = (int) ((price/5.0)*(selectedTopics-2));
      }
                    
                    
      view.setBasePrice(price,topicsPrice,selectedTopics,
                        price+topicsPrice);
}
1 Answers
Related