The motivation here is that users should be able to declare DeepLinks with a replaceable path segment (or segments) and then replace them at runtime (e.g. based on build type or a configuration flag).
This test covers the happy path of this change (other tests cover unhappy paths):
public void testPlaceholderSubstitution() {
Map<String, String> pathVariableReplacements = new HashMap<>();
pathVariableReplacements.put("replaceable-path-variable", "obamaOs");
DeepLinkDelegate deepLinkDelegate = new DeepLinkDelegate(new SampleModuleRegistry(),
new LibraryDeepLinkModuleRegistry(), new BenchmarkDeepLinkModuleRegistry(), pathVariableReplacements);
assertThat(deepLinkDelegate.supportsUri("https://www.example.com/capnMcCains/bar"), equalTo(false));
assertThat(deepLinkDelegate.supportsUri("https://www.example.com/obamaOs/bar"), equalTo(true));
}
Given:
mapOf("some-key" to "bar", "high-key" to "hyphy")
into BaseDeepLinkDelegate.@DeepLink("https://www.example.com/foo/%%%some-key%%%/baz")
example@DeepLink("https://www.example.com/you/only/%%%some-key%%%/%%%high-key%%%")
Then:
baseDeepLinkDelegate.supporstUri("https://www.example.com/foo/bar/baz") //true
baseDeepLinkDelegate.supportsUri("https://www.example.com/foo/hyphy/baz") //false
baseDeepLinkDelegate.supportsUri("https://www.example.com/you/only/bar/hyphy") //true
The motivation here is that users should be able to declare DeepLinks with a replaceable path segment (or segments) and then replace them at runtime (e.g. based on build type or a configuration flag).
This test covers the happy path of this change (other tests cover unhappy paths):
./gradlew check test
: