Ignore:
Timestamp:
2016-01-18T12:43:17+01:00 (9 years ago)
Author:
simon04
Message:

JOSM/wikipedia: Wikidata title should be displayed in user's language - #josm12397

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wikipedia/test/unit/org/wikipedia/WikipediaAppTest.java

    r31907 r32001  
    1313import java.util.Collection;
    1414import java.util.List;
     15import java.util.Locale;
    1516import java.util.Map;
    1617
     
    2526    public void setUp() throws Exception {
    2627        Main.initApplicationPreferences();
     28    }
     29
     30    @Test
     31    public void testMediawikiLocale() throws Exception {
     32        assertThat(WikipediaApp.getMediawikiLocale(Locale.GERMANY), is("de-de"));
     33        assertThat(WikipediaApp.getMediawikiLocale(Locale.GERMAN), is("de"));
     34        assertThat(WikipediaApp.getMediawikiLocale(Locale.UK), is("en-gb"));
     35        assertThat(WikipediaApp.getMediawikiLocale(Locale.CANADA), is("en-ca"));
    2736    }
    2837
     
    146155    @Test
    147156    public void testGetLabelForWikidata() throws Exception {
    148         assertThat(WikipediaApp.getLabelForWikidata("Q1741", "de"), is("Wien"));
    149         assertThat(WikipediaApp.getLabelForWikidata("Q1741", "en"), is("Vienna"));
    150         assertThat(WikipediaApp.getLabelForWikidata("Q" + Long.MAX_VALUE, "en"), nullValue());
     157        assertThat(WikipediaApp.getLabelForWikidata("Q1741", Locale.GERMAN), is("Wien"));
     158        assertThat(WikipediaApp.getLabelForWikidata("Q1741", Locale.ENGLISH), is("Vienna"));
     159        assertThat(WikipediaApp.getLabelForWikidata("Q" + Long.MAX_VALUE, Locale.ENGLISH), nullValue());
    151160    }
    152161
    153162    @Test(expected = RuntimeException.class)
    154163    public void testGetLabelForWikidataInvalidId() throws Exception {
    155         WikipediaApp.getLabelForWikidata("Qxyz", "en");
     164        WikipediaApp.getLabelForWikidata("Qxyz", Locale.ENGLISH);
    156165    }
    157166
Note: See TracChangeset for help on using the changeset viewer.