31 lines
1.2 KiB
Java
31 lines
1.2 KiB
Java
package org.julianfamily.keepassgo;
|
|
|
|
public final class AutofillFallbackTargetBehaviorTest {
|
|
public static void main(String[] args) {
|
|
testPrefersWebDomainWhenPresent();
|
|
testFallsBackToAndroidAppPackage();
|
|
testEmptyWhenNeitherSignalExists();
|
|
}
|
|
|
|
private static void testPrefersWebDomainWhenPresent() {
|
|
String got = AutofillFallbackTarget.resolve("com.android.chrome", "gitlab.com");
|
|
if (!"gitlab.com".equals(got)) {
|
|
throw new AssertionError("resolve(chrome, gitlab.com) = " + got + ", want gitlab.com");
|
|
}
|
|
}
|
|
|
|
private static void testFallsBackToAndroidAppPackage() {
|
|
String got = AutofillFallbackTarget.resolve("com.blinknetwork.mobile2", "");
|
|
if (!"androidapp://com.blinknetwork.mobile2".equals(got)) {
|
|
throw new AssertionError("resolve(package-only) = " + got + ", want androidapp://com.blinknetwork.mobile2");
|
|
}
|
|
}
|
|
|
|
private static void testEmptyWhenNeitherSignalExists() {
|
|
String got = AutofillFallbackTarget.resolve("", "");
|
|
if (!"".equals(got)) {
|
|
throw new AssertionError("resolve(empty) = " + got + ", want empty");
|
|
}
|
|
}
|
|
}
|