aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/ParserTest.java
blob: 1f615544efc3015a5e5c00691cee227a79a94704 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package cgeo.geocaching;

import cgeo.geocaching.test.R;

import android.test.InstrumentationTestCase;

import java.io.InputStream;
import java.util.Scanner;

public class ParserTest extends InstrumentationTestCase {

    private String getFileContent(int resourceId) {
        InputStream ins = getInstrumentation().getContext().getResources().openRawResource(resourceId);
        return new Scanner(ins).useDelimiter("\\A").next();
    }

    public void testOwnerDecoding() {
        cgCacheWrap caches = cgBase.parseCacheFromText(getFileContent(R.raw.gc1zxez), 0, null);
        assertEquals(1, caches.cacheList.size());
        final cgCache cache = caches.cacheList.get(0);
        assertEquals("Ms.Marple/Mr.Stringer", cache.ownerReal);
    }
}