aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/androidTest/java/org/wordpress/android/models/CategoryNodeInstrumentationTest.java
blob: 8eef7cff392d8577177aba3ddf32f3518882ff35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package org.wordpress.android.models;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.test.InstrumentationTestCase;
import android.test.RenamingDelegatingContext;

import org.wordpress.android.TestUtils;

public class CategoryNodeInstrumentationTest extends InstrumentationTestCase {
    protected Context testContext;
    protected Context targetContext;

    @Override
    protected void setUp() {
        // Run tests in an isolated context
        targetContext = new RenamingDelegatingContext(getInstrumentation().getTargetContext(), "test_");
        testContext = getInstrumentation().getContext();
    }

    public void testLoadDB_MalformedCategoryParentId() {
        SQLiteDatabase db = TestUtils.loadDBFromDump(targetContext, testContext,
                "malformed_category_parent_id.sql");

        // This line failed before #36 was solved
        CategoryNode node = CategoryNode.createCategoryTreeFromDB(1);
    }

    public void tearDown() throws Exception {
        targetContext = null;
        testContext = null;
        super.tearDown();
    }
}