@Test public void createListener() { LocationEngineCallback<LocationEngineResult> callback = mock(LocationEngineCallback.class); LocationListener locationListener = androidLocationEngineImpl.createListener(callback); Location mockLocation = getMockLocation(LATITUDE, LONGITUDE); locationListener.onLocationChanged(mockLocation); ArgumentCaptor<LocationEngineResult> argument = ArgumentCaptor.forClass(LocationEngineResult.class); verify(callback).onSuccess(argument.capture()); LocationEngineResult result = argument.getValue(); assertThat(result.getLastLocation()).isSameAs(mockLocation); }
@NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); }
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } }
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } AndroidLocationEngineImpl(@NonNull Context context); }
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } AndroidLocationEngineImpl(@NonNull Context context); @NonNull @Override LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback); @Override void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback); @SuppressLint("MissingPermission") @Override void requestLocationUpdates(@NonNull LocationEngineRequest request,
                                     @NonNull LocationListener listener,
                                     @Nullable Looper looper); @SuppressLint("MissingPermission") @Override void requestLocationUpdates(@NonNull LocationEngineRequest request,
                                     @NonNull PendingIntent pendingIntent); @SuppressLint("MissingPermission") @Override void removeLocationUpdates(@NonNull LocationListener listener); @Override void removeLocationUpdates(PendingIntent pendingIntent); }
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } AndroidLocationEngineImpl(@NonNull Context context); @NonNull @Override LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback); @Override void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback); @SuppressLint("MissingPermission") @Override void requestLocationUpdates(@NonNull LocationEngineRequest request,
                                     @NonNull LocationListener listener,
                                     @Nullable Looper looper); @SuppressLint("MissingPermission") @Override void requestLocationUpdates(@NonNull LocationEngineRequest request,
                                     @NonNull PendingIntent pendingIntent); @SuppressLint("MissingPermission") @Override void removeLocationUpdates(@NonNull LocationListener listener); @Override void removeLocationUpdates(PendingIntent pendingIntent);  }