use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class WikiSiteTypeAdapterTest method testWriteRead.
@Test
public void testWriteRead() {
WikiSite wiki = WikiSite.forLanguageCode("test");
assertThat(unmarshal(WikiSite.class, marshal(wiki)), is(wiki));
}
use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class PageTitleTest method testWikiSite.
@Test
public void testWikiSite() throws Throwable {
WikiSite enwiki = WikiSite.forLanguageCode("en");
assertThat(new PageTitle(null, "Test", enwiki).getWikiSite(), is(enwiki));
assertThat(WikiSite.forLanguageCode("en"), is(enwiki));
}
use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class PageTitleTest method testIsMainPageTitleNoProps.
@Test
public void testIsMainPageTitleNoProps() throws Throwable {
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));
}
use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class PageTitleTest method testJsonSerialization.
@Test
public void testJsonSerialization() throws Throwable {
WikiSite enwiki = WikiSite.forLanguageCode("en");
PageTitle title = new PageTitle(null, "Test title", enwiki);
assertThat(title, is(new PageTitle(title.toJSON())));
title = new PageTitle("Talk", "Test title", enwiki);
assertThat(new PageTitle(title.toJSON()), is(title));
}
use of org.wikipedia.dataclient.WikiSite in project apps-android-wikipedia by wikimedia.
the class PageTitleTest method testParsing.
@Test
public void testParsing() throws Throwable {
WikiSite enwiki = WikiSite.forLanguageCode("en");
assertThat(new PageTitle("Hello", enwiki).getDisplayText(), is("Hello"));
assertThat(new PageTitle("Talk:Hello", enwiki).getDisplayText(), is("Talk:Hello"));
assertThat(new PageTitle("Talk:Hello", enwiki).getText(), is("Hello"));
assertThat(new PageTitle("Talk:Hello", enwiki).getNamespace(), is("Talk"));
assertThat(new PageTitle("Wikipedia_talk:Hello world", enwiki).getDisplayText(), is("Wikipedia talk:Hello world"));
}
Aggregations