@Test public void testErrorHandlerNotGettingCalled() { String deeplinkUrl1 = "airbnb: String deeplinkUrl2 = "airbnb: String matchUrl = "airbnb: DeepLinkEntry entry1 = deepLinkEntry(deeplinkUrl1); DeepLinkEntry entry2 = deepLinkEntry(deeplinkUrl2); Uri uri = mock(Uri.class); when(uri.toString()) .thenReturn(matchUrl); Intent intent = mock(Intent.class); when(intent.getData()) .thenReturn(uri); Context appContext = mock(Context.class); Activity activity = mock(Activity.class); when(activity.getIntent()) .thenReturn(intent); when(activity.getApplicationContext()) .thenReturn(appContext); TestErrorHandler errorHandler = new TestErrorHandler(); TestDeepLinkDelegate testDelegate = getTwoRegistriesTestDelegate(Arrays.asList(new DeepLinkEntry[]{entry1}), Arrays.asList(new DeepLinkEntry[]{entry2}), errorHandler); DeepLinkResult result = testDelegate.dispatchFrom(activity, intent); assertThat(errorHandler.duplicatedMatchCalled()).isFalse(); assertThat(result.getDeepLinkEntry().equals(entry2)); }
public DeepLinkResult dispatchFrom(Activity activity) { validateInput(activity); return dispatchFrom(activity, activity.getIntent()); }
BaseDeepLinkDelegate { public DeepLinkResult dispatchFrom(Activity activity) { validateInput(activity); return dispatchFrom(activity, activity.getIntent()); } }
BaseDeepLinkDelegate { public DeepLinkResult dispatchFrom(Activity activity) { validateInput(activity); return dispatchFrom(activity, activity.getIntent()); } BaseDeepLinkDelegate(List<? extends BaseRegistry> registries);  BaseDeepLinkDelegate(List<? extends BaseRegistry> registries, ErrorHandler errorHandler);  BaseDeepLinkDelegate(
    List<? extends BaseRegistry> registries,
    Map<String, String> configurablePathSegmentReplacements
  );  BaseDeepLinkDelegate(
    List<? extends BaseRegistry> registries,
    Map<String, String> configurablePathSegmentReplacements,
    ErrorHandler errorHandler
  ); }
BaseDeepLinkDelegate { public DeepLinkResult dispatchFrom(Activity activity) { validateInput(activity); return dispatchFrom(activity, activity.getIntent()); } BaseDeepLinkDelegate(List<? extends BaseRegistry> registries);  BaseDeepLinkDelegate(List<? extends BaseRegistry> registries, ErrorHandler errorHandler);  BaseDeepLinkDelegate(
    List<? extends BaseRegistry> registries,
    Map<String, String> configurablePathSegmentReplacements
  );  BaseDeepLinkDelegate(
    List<? extends BaseRegistry> registries,
    Map<String, String> configurablePathSegmentReplacements,
    ErrorHandler errorHandler
  ); List<? extends BaseRegistry> getRegistries(); DeepLinkResult dispatchFrom(Activity activity); DeepLinkResult dispatchFrom(Activity activity, Intent sourceIntent); @NonNull DeepLinkResult createResult(
    Activity activity, Intent sourceIntent, DeepLinkEntry deepLinkEntry
  ); boolean supportsUri(String uriString); }
BaseDeepLinkDelegate { public DeepLinkResult dispatchFrom(Activity activity) { validateInput(activity); return dispatchFrom(activity, activity.getIntent()); } BaseDeepLinkDelegate(List<? extends BaseRegistry> registries);  BaseDeepLinkDelegate(List<? extends BaseRegistry> registries, ErrorHandler errorHandler);  BaseDeepLinkDelegate(
    List<? extends BaseRegistry> registries,
    Map<String, String> configurablePathSegmentReplacements
  );  BaseDeepLinkDelegate(
    List<? extends BaseRegistry> registries,
    Map<String, String> configurablePathSegmentReplacements,
    ErrorHandler errorHandler
  ); List<? extends BaseRegistry> getRegistries(); DeepLinkResult dispatchFrom(Activity activity); DeepLinkResult dispatchFrom(Activity activity, Intent sourceIntent); @NonNull DeepLinkResult createResult(
    Activity activity, Intent sourceIntent, DeepLinkEntry deepLinkEntry
  ); boolean supportsUri(String uriString);  }