@Test public void fusedLocationClient_returnedWhenPlayServicesAvailable() { when(playServicesChecker.isGooglePlayServicesAvailable(any())).thenReturn(true); LocationClient client = LocationClientProvider.getClient(context, playServicesChecker, () -> googleFusedLocationClient); assertThat(client, is(googleFusedLocationClient)); }
public static LocationClient getClient(@NonNull Context context, @NonNull PlayServicesChecker playServicesChecker, @NonNull Supplier<GoogleFusedLocationClient> googleFusedLocationClientProvider) { return testClient != null ? testClient : playServicesChecker.isGooglePlayServicesAvailable(context) ? googleFusedLocationClientProvider.get() : new AndroidLocationClient(context); }
LocationClientProvider { public static LocationClient getClient(@NonNull Context context, @NonNull PlayServicesChecker playServicesChecker, @NonNull Supplier<GoogleFusedLocationClient> googleFusedLocationClientProvider) { return testClient != null ? testClient : playServicesChecker.isGooglePlayServicesAvailable(context) ? googleFusedLocationClientProvider.get() : new AndroidLocationClient(context); } }
LocationClientProvider { public static LocationClient getClient(@NonNull Context context, @NonNull PlayServicesChecker playServicesChecker, @NonNull Supplier<GoogleFusedLocationClient> googleFusedLocationClientProvider) { return testClient != null ? testClient : playServicesChecker.isGooglePlayServicesAvailable(context) ? googleFusedLocationClientProvider.get() : new AndroidLocationClient(context); } private  LocationClientProvider(); }
LocationClientProvider { public static LocationClient getClient(@NonNull Context context, @NonNull PlayServicesChecker playServicesChecker, @NonNull Supplier<GoogleFusedLocationClient> googleFusedLocationClientProvider) { return testClient != null ? testClient : playServicesChecker.isGooglePlayServicesAvailable(context) ? googleFusedLocationClientProvider.get() : new AndroidLocationClient(context); } private  LocationClientProvider(); static LocationClient getClient(@NonNull Context context, @NonNull PlayServicesChecker playServicesChecker,
                                           @NonNull Supplier<GoogleFusedLocationClient> googleFusedLocationClientProvider); static void setTestClient(@NonNull LocationClient testClient); }
LocationClientProvider { public static LocationClient getClient(@NonNull Context context, @NonNull PlayServicesChecker playServicesChecker, @NonNull Supplier<GoogleFusedLocationClient> googleFusedLocationClientProvider) { return testClient != null ? testClient : playServicesChecker.isGooglePlayServicesAvailable(context) ? googleFusedLocationClientProvider.get() : new AndroidLocationClient(context); } private  LocationClientProvider(); static LocationClient getClient(@NonNull Context context, @NonNull PlayServicesChecker playServicesChecker,
                                           @NonNull Supplier<GoogleFusedLocationClient> googleFusedLocationClientProvider); static void setTestClient(@NonNull LocationClient testClient);  }