diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-05-17 13:37:16 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-05-17 13:37:16 +0200 |
| commit | a32ebb0d12e3501b57c043d0912230acd807b228 (patch) | |
| tree | 27f728a2ab24b2ad1855c6e3ac526f9dc6705e9b /tests | |
| parent | 02004207ed83c3996a5fdf7a765ba9f8264010d6 (diff) | |
| download | cgeo-a32ebb0d12e3501b57c043d0912230acd807b228.zip cgeo-a32ebb0d12e3501b57c043d0912230acd807b228.tar.gz cgeo-a32ebb0d12e3501b57c043d0912230acd807b228.tar.bz2 | |
avoid NPE on CI
Funny enough, locally that same exception does not happen.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/src/cgeo/geocaching/files/FileTypeDetectorTest.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/src/cgeo/geocaching/files/FileTypeDetectorTest.java b/tests/src/cgeo/geocaching/files/FileTypeDetectorTest.java index ec7b3a8..5dbf3c2 100644 --- a/tests/src/cgeo/geocaching/files/FileTypeDetectorTest.java +++ b/tests/src/cgeo/geocaching/files/FileTypeDetectorTest.java @@ -8,16 +8,16 @@ import cgeo.geocaching.test.R; import org.eclipse.jdt.annotation.NonNull; import android.content.ContentResolver; +import android.content.Context; import android.net.Uri; public class FileTypeDetectorTest extends AbstractResourceInstrumentationTestCase { - private static class FileContentProvider extends ContentResolver { + private static class FileContentResolver extends ContentResolver { - public FileContentProvider() { - super(null); + public FileContentResolver(Context context) { + super(context); } - } public void testUnknown() throws Exception { @@ -46,6 +46,7 @@ public class FileTypeDetectorTest extends AbstractResourceInstrumentationTestCas private void assertFileType(final int resourceId, final @NonNull FileType fileType) { final Uri resourceURI = getResourceURI(resourceId); - assertThat(new FileTypeDetector(resourceURI, new FileContentProvider()).getFileType()).isEqualTo(fileType); + final FileContentResolver contentResolver = new FileContentResolver(getInstrumentation().getContext()); + assertThat(new FileTypeDetector(resourceURI, contentResolver).getFileType()).isEqualTo(fileType); } } |
