Skip to content

Commit 15e0f48

Browse files
authored
Merge pull request #968 from maskaravivek/uploadTests
Test for file upload util method
2 parents 569b82e + 6d718c0 commit 15e0f48

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
}

0 commit comments

Comments
 (0)