WikiSite implements Parcelable { @NonNull public String dbName() { return subdomain().replaceAll("-", "_") + "wiki"; } WikiSite(@NonNull Uri uri);  WikiSite(@NonNull String url);  WikiSite(@NonNull String authority, @NonNull String languageCode); protected  WikiSite(@NonNull Parcel in); static boolean supportedAuthority(@NonNull String authority); static void setDefaultBaseUrl(@NonNull String url); static WikiSite forLanguageCode(@NonNull String languageCode); @NonNull String scheme(); @NonNull String authority(); @NonNull String mobileAuthority(); String mobileUrl(); @NonNull String desktopAuthority(); @NonNull String subdomain(); @NonNull String path(@NonNull String segment); @NonNull Uri uri(); @NonNull String url(); @NonNull String url(@NonNull String segment); @NonNull String languageCode(); PageTitle titleForInternalLink(String internalLink); PageTitle titleForUri(Uri uri); @NonNull String dbName(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override int describeContents(); @Override void writeToParcel(@NonNull Parcel dest, int flags); static final String DEFAULT_SCHEME; static final Parcelable.Creator<WikiSite> CREATOR; }
@Test public void testDbNameLanguage() { WikiSite subject = new WikiSite("en.wikipedia.org", "en"); assertThat(subject.dbName(), is("enwiki")); }
@Test public void testDbNameSpecialLanguage() { WikiSite subject = new WikiSite("no.wikipedia.org", "nb"); assertThat(subject.dbName(), is("nowiki")); }
@Test public void testDbNameWithOneUnderscore() { WikiSite subject = new WikiSite("zh-yue.wikipedia.org"); assertThat(subject.dbName(), is("zh_yuewiki")); }
@Test public void testDbNameWithTwoUnderscore() { WikiSite subject = new WikiSite("zh-min-nan.wikipedia.org"); assertThat(subject.dbName(), is("zh_min_nanwiki")); }