package org.commcare.dalvik.application;

import org.commcare.android.database.HybridFileBackedSqlStorage;
import org.commcare.android.database.HybridFileBackedSqlStorageMock;
import org.javarosa.core.services.storage.Persistable;

/**
 * @author Phillip Mates (pmates@dimagi.com).
 */
public class CommCareTestApplication extends CommCareApplication {
    @Override
    public <T extends Persistable> HybridFileBackedSqlStorage<T> getFileBackedAppStorage(String name, Class<T> c) {
        return getCurrentApp().getFileBackedStorage(name, c);
    }

    @Override
    public <T extends Persistable> HybridFileBackedSqlStorage<T> getFileBackedUserStorage(String storage, Class<T> c) {
        return new HybridFileBackedSqlStorageMock<>(storage, c, buildUserDbHandle(), getUserKeyRecordId());
    }

    @Override
    public CommCareApp getCurrentApp() {
        return new CommCareTestApp(super.getCurrentApp());
    }
}

@@ -223,16 +223,41 @@
 istable;
+%0Aimport org.junit.Assert;
 %0A%0A/**%0A *
@@ -371,16 +371,350 @@
 ation %7B%0A
+    @Override%0A    public void onCreate() %7B%0A        super.onCreate();%0A%0A        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() %7B%0A            @Override%0A            public void uncaughtException(Thread thread, Throwable ex) %7B%0A                Assert.fail(ex.getMessage());%0A            %7D%0A        %7D);%0A    %7D%0A%0A
     @Ove

Add top-level exception handler that just fails test