Utils { static void notifyLocationUpdates(@NonNull Context context, @Nullable final Location location) { final CTLocationUpdatesListener ctLocationUpdatesListener = CTGeofenceAPI.getInstance(context) .getCtLocationUpdatesListener(); if (ctLocationUpdatesListener != null) { com.clevertap.android.sdk.Utils.runOnUiThread(new Runnable() { @Override public void run() { ctLocationUpdatesListener.onLocationUpdates(location); } }); } }    }
@Test public void testNotifyLocationUpdates() { mockStatic(com.clevertap.android.sdk.Utils.class); CTLocationUpdatesListener locationUpdatesListener = Mockito.mock(CTLocationUpdatesListener.class); Mockito.when(ctGeofenceAPI.getCtLocationUpdatesListener()).thenReturn(locationUpdatesListener); Utils.notifyLocationUpdates(application, Mockito.mock(Location.class)); ArgumentCaptor<Runnable> runnableArgumentCaptor = ArgumentCaptor.forClass(Runnable.class); verifyStatic(com.clevertap.android.sdk.Utils.class); com.clevertap.android.sdk.Utils.runOnUiThread(runnableArgumentCaptor.capture()); runnableArgumentCaptor.getValue().run(); Mockito.verify(locationUpdatesListener).onLocationUpdates(any(Location.class)); }