Skip to content

Commit

Permalink
apparently android doesn't want us to test content providers 🤷 lmk if…
Browse files Browse the repository at this point in the history
… there's something not deprecated or broken
  • Loading branch information
F43nd1r committed Nov 27, 2022
1 parent 13e841b commit 0e193ff
Showing 1 changed file with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,17 @@

package org.acra.attachment;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.provider.OpenableColumns;

import android.test.ProviderTestCase2;
import android.webkit.MimeTypeMap;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.provider.ProviderTestRule;

import org.acra.ACRA;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -46,24 +38,21 @@
*/
@Ignore
@RunWith(AndroidJUnit4.class)
public class AcraContentProviderTest {

@Rule
public ProviderTestRule rule = new ProviderTestRule.Builder(AcraContentProvider.class, "org.acra.test.acra").build();
public class AcraContentProviderTest extends ProviderTestCase2<AcraContentProvider> {
private static final String JSON_EXTENSION = "json";
private static final String JSON_MIMETYPE = "application/json";

private ContentResolver resolver;
private File file;

public AcraContentProviderTest() {
InstrumentationRegistry.getInstrumentation()
super(AcraContentProvider.class, ApplicationProvider.getApplicationContext().getPackageName() + ".acra");
}

@Before
public void setUp() throws Exception {
ACRA.DEV_LOGGING = true;
resolver = rule.getResolver();
resolver = ApplicationProvider.getApplicationContext().getContentResolver();
file = File.createTempFile("test", "." + JSON_EXTENSION);
}

Expand Down

0 comments on commit 0e193ff

Please sign in to comment.