PageTitle implements Parcelable { public boolean isMainPage() { return properties != null && properties.isMainPage(); } PageTitle(@Nullable final String namespace, @NonNull String text, @Nullable String fragment, @Nullable String thumbUrl, @NonNull WikiSite wiki);  PageTitle(@Nullable String text, @NonNull WikiSite wiki, @Nullable String thumbUrl, @Nullable String description, @Nullable PageProperties properties);  PageTitle(@Nullable String text, @NonNull WikiSite wiki, @Nullable String thumbUrl, @Nullable String description);  PageTitle(@Nullable String namespace, @NonNull String text, @NonNull WikiSite wiki);  PageTitle(@Nullable String text, @NonNull WikiSite wiki, @Nullable String thumbUrl);  PageTitle(@Nullable String text, @NonNull WikiSite wiki); private  PageTitle(@Nullable String text, @NonNull WikiSite wiki, @Nullable String thumbUrl,
                      @Nullable PageProperties properties); private  PageTitle(Parcel in); static PageTitle withSeparateFragment(@NonNull String prefixedText,
                                                 @Nullable String fragment, @NonNull WikiSite wiki); @Nullable String getNamespace(); @NonNull Namespace namespace(); @NonNull WikiSite getWikiSite(); @NonNull String getText(); @Nullable String getFragment(); @Nullable String getThumbUrl(); void setThumbUrl(@Nullable String thumbUrl); @Nullable String getDescription(); void setDescription(@Nullable String description); @NonNull String getConvertedText(); void setConvertedText(@Nullable String convertedText); @NonNull String getDisplayText(); @NonNull String getDisplayTextWithoutNamespace(); boolean hasProperties(); @Nullable PageProperties getProperties(); boolean isMainPage(); boolean isDisambiguationPage(); String getCanonicalUri(); String getMobileUri(); String getUriForAction(String action); String getPrefixedText(); boolean isFilePage(); boolean isSpecial(); boolean isTalkPage(); @Override void writeToParcel(Parcel parcel, int flags); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override int describeContents(); static final Parcelable.Creator<PageTitle> CREATOR; }
@Test public void testIsMainPageNoTitleNoProps() { final String text = null; WikiSite wiki = WikiSite.forLanguageCode("test"); final String thumbUrl = null; final String desc = null; final PageProperties props = null; PageTitle subject = new PageTitle(text, wiki, thumbUrl, desc, props); assertThat(subject.isMainPage(), is(false)); }
@Test public void testIsMainPageTitleNoProps() { String text = "text"; WikiSite wiki = WikiSite.forLanguageCode("test"); final String thumbUrl = null; final String desc = null; final PageProperties props = null; PageTitle subject = new PageTitle(text, wiki, thumbUrl, desc, props); assertThat(subject.isMainPage(), is(false)); }
@Test public void testIsMainPageProps() { String text = "text"; WikiSite wiki = WikiSite.forLanguageCode("test"); final String thumbUrl = null; final String desc = null; PageProperties props = mock(PageProperties.class); when(props.isMainPage()).thenReturn(true); PageTitle subject = new PageTitle(text, wiki, thumbUrl, desc, props); assertThat(subject.isMainPage(), is(true)); }