use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class PageTitleTest method testPrefixedText.
@Test
public void testPrefixedText() throws Throwable {
WikiSite enwiki = WikiSite.forLanguageCode("en");
assertThat(new PageTitle(null, "Test title", enwiki).getPrefixedText(), is("Test__title"));
assertThat(new PageTitle(null, "Test title", enwiki).getPrefixedText(), is("Test_title"));
assertThat(new PageTitle("Talk", "Test title", enwiki).getPrefixedText(), is("Talk:Test_title"));
assertThat(new PageTitle(null, "Test title", enwiki).getText(), is("Test_title"));
}
use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class PageTitleTest method testFromInternalLink.
@Test
public void testFromInternalLink() throws Throwable {
WikiSite enwiki = WikiSite.forLanguageCode("en");
assertThat(enwiki.titleForInternalLink("/wiki/India").getPrefixedText(), is("India"));
assertThat(enwiki.titleForInternalLink("/wiki/India").getNamespace(), nullValue());
assertThat(enwiki.titleForInternalLink("/wiki/Talk:India").getNamespace(), is("Talk"));
assertThat(enwiki.titleForInternalLink("/wiki/Talk:India").getText(), is("India"));
assertThat(enwiki.titleForInternalLink("/wiki/Talk:India").getFragment(), nullValue());
assertThat(enwiki.titleForInternalLink("/wiki/Talk:India#").getNamespace(), is("Talk"));
assertThat(enwiki.titleForInternalLink("/wiki/Talk:India#").getText(), is("India"));
assertThat(enwiki.titleForInternalLink("/wiki/Talk:India#").getFragment(), is(""));
assertThat(enwiki.titleForInternalLink("/wiki/Talk:India#History").getNamespace(), is("Talk"));
assertThat(enwiki.titleForInternalLink("/wiki/Talk:India#History").getText(), is("India"));
assertThat(enwiki.titleForInternalLink("/wiki/Talk:India#History").getFragment(), is("History"));
}
use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class PageTitleTest method testCanonicalURL.
@Test
public void testCanonicalURL() throws Throwable {
WikiSite enwiki = WikiSite.forLanguageCode("en");
assertThat(enwiki.titleForInternalLink("/wiki/India").getCanonicalUri(), is("https://en.wikipedia.org/wiki/India"));
assertThat(enwiki.titleForInternalLink("/wiki/India Gate").getCanonicalUri(), is("https://en.wikipedia.org/wiki/India_Gate"));
assertThat(enwiki.titleForInternalLink("/wiki/India's Gate").getCanonicalUri(), is("https://en.wikipedia.org/wiki/India%27s_Gate"));
}
use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class PageTitleTest method testMainPage.
@Test
public void testMainPage() throws Throwable {
WikiSite enwiki = WikiSite.forLanguageCode("en");
assertThat(new PageTitle("", enwiki), is(new PageTitle(MainPageNameData.valueFor("en"), enwiki)));
}
use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class PageTitleTest method testIsMainPageNoTitleNoProps.
@Test
public void testIsMainPageNoTitleNoProps() throws Throwable {
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(true));
}
Aggregations