Search in sources :

Example 1 with Namespace

use of org.wikipedia.page.Namespace in project apps-android-wikipedia by wikimedia.

the class NamespaceTypeAdapterTest method testWriteRead.

@Test
public void testWriteRead() {
    Namespace result = unmarshal(Namespace.class, marshal(namespace));
    assertThat(result, is(namespace));
}
Also used : Namespace(org.wikipedia.page.Namespace) Test(org.junit.Test)

Example 2 with Namespace

use of org.wikipedia.page.Namespace in project apps-android-wikipedia by wikimedia.

the class NamespaceTypeAdapterTest method testReadOldData.

@Test
public void testReadOldData() throws Throwable {
    // Prior to 3210ce44, we marshaled Namespace as the name string of the enum, instead of
    // the code number, and when we switched to using the code number, we didn't introduce
    // backwards-compatible checks for the old-style strings that may still be present in
    // some local serialized data.
    // TODO: remove after April 2017?
    String marshaledStr = namespace == null ? "null" : "\"" + namespace.name() + "\"";
    Namespace ns = unmarshal(Namespace.class, marshaledStr);
    assertThat(ns, is(namespace));
}
Also used : Namespace(org.wikipedia.page.Namespace) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Namespace (org.wikipedia.page.Namespace)2