Files
keepassgo/androidtestsrc/org/julianfamily/keepassgo/AutofillFallbackTargetBehaviorTest.java
T
2026-04-23 20:44:32 -07:00

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");
}
}
}