Stanly Moses Stanly Moses - 1 year ago 137
Android Question

How to mock Context using Mockito?

I'm using Context to access system level services like WifiManager and BluetoothManager. How to mock this getApplicationContext() using Mockito?

Answer Source

Let's have a look at the following class: MockContext

If you need more insight, check the Official Testing Fundamentals page

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download