File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
app/src/androidTest/java/fr/free/nrw/commons/upload Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ package fr .free .nrw .commons .upload ;
2+
3+ import android .net .Uri ;
4+ import android .support .test .InstrumentationRegistry ;
5+ import android .support .test .runner .AndroidJUnit4 ;
6+
7+ import org .junit .Test ;
8+ import org .junit .runner .RunWith ;
9+
10+ import static org .hamcrest .CoreMatchers .is ;
11+ import static org .junit .Assert .assertThat ;
12+
13+ @ RunWith (AndroidJUnit4 .class )
14+ public class FileUtilsTest {
15+ @ Test
16+ public void isSelfOwned () throws Exception {
17+ Uri uri = Uri .parse ("content://fr.free.nrw.commons.provider/document/1" );
18+ boolean selfOwned = FileUtils .isSelfOwned (InstrumentationRegistry .getTargetContext (), uri );
19+ assertThat (selfOwned , is (true ));
20+ }
21+
22+ @ Test
23+ public void isNotSelfOwned () throws Exception {
24+ Uri uri = Uri .parse ("content://com.android.providers.media.documents/document/1" );
25+ boolean selfOwned = FileUtils .isSelfOwned (InstrumentationRegistry .getTargetContext (), uri );
26+ assertThat (selfOwned , is (false ));
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments