Search in sources :

Example 6 with WikiSite

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));
}
Also used : WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Example 7 with WikiSite

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));
}
Also used : WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Example 8 with WikiSite

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));
}
Also used : WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Example 9 with WikiSite

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));
}
Also used : WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Example 10 with WikiSite

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"));
}
Also used : WikiSite(org.wikipedia.dataclient.WikiSite) Test(org.junit.Test)

Aggregations

WikiSite (org.wikipedia.dataclient.WikiSite)35 Test (org.junit.Test)22 PageTitle (org.wikipedia.page.PageTitle)11 HistoryEntry (org.wikipedia.history.HistoryEntry)5 Date (java.util.Date)4 Uri (android.net.Uri)3 Bundle (android.os.Bundle)2 View (android.view.View)2 ArrayList (java.util.ArrayList)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 Page (org.wikipedia.page.Page)2 PageBackStackItem (org.wikipedia.page.PageBackStackItem)2 PageProperties (org.wikipedia.page.PageProperties)2 Tab (org.wikipedia.page.tabs.Tab)2 MockWebServerTest (org.wikipedia.test.MockWebServerTest)2 ProgressDialog (android.app.ProgressDialog)1 AssetManager (android.content.res.AssetManager)1 Configuration (android.content.res.Configuration)1 Resources (android.content.res.Resources)1