Reputation: 115
I am trying to write junit test cases for my Bluetooth Code testing in android . My public method tries to call the buletooth adapter but its giving error like java.lang.RuntimeException: Method getDefaultAdapter in android.bluetooth.BluetoothAdapter not mocked.
any help would be highly appreciable.
Upvotes: 4
Views: 5382
Reputation: 2121
BluetoothAdapter in the Android framework is declared final, so it cannot be mocked using Mockito or Robolectric. However, it is possible using PowerMock. Take a look at this example.
Upvotes: 0