1 package com.android.documentsui.picker; 2 3 import static com.google.common.truth.Truth.assertThat; 4 5 import android.net.Uri; 6 import androidx.test.filters.SmallTest; 7 import androidx.test.runner.AndroidJUnit4; 8 import org.junit.Before; 9 import org.junit.Test; 10 import org.junit.runner.RunWith; 11 12 @RunWith(AndroidJUnit4.class) 13 @SmallTest 14 public final class PickResultTest { 15 private PickResult mPickResult; 16 17 @Before setUp()18 public void setUp() { 19 mPickResult = new PickResult(); 20 } 21 22 @Test testActionCount()23 public void testActionCount() { 24 mPickResult.increaseActionCount(); 25 assertThat(mPickResult.getActionCount()).isEqualTo(1); 26 } 27 28 @Test testDuration()29 public void testDuration() { 30 mPickResult.setPickStartTime(487); 31 mPickResult.increaseDuration(9487); 32 assertThat(mPickResult.getDuration()).isEqualTo(9000); 33 } 34 35 @Test testFileCount()36 public void testFileCount() { 37 mPickResult.setFileCount(10); 38 assertThat(mPickResult.getFileCount()).isEqualTo(10); 39 } 40 41 @Test testIsSearching()42 public void testIsSearching() { 43 mPickResult.setIsSearching(true); 44 assertThat(mPickResult.isSearching()).isTrue(); 45 } 46 47 @Test testRoot()48 public void testRoot() { 49 mPickResult.setRoot(2); 50 assertThat(mPickResult.getRoot()).isEqualTo(2); 51 } 52 53 @Test testMimeType()54 public void testMimeType() { 55 mPickResult.setMimeType(3); 56 assertThat(mPickResult.getMimeType()).isEqualTo(3); 57 } 58 59 @Test testRepeatedlyPickTimes()60 public void testRepeatedlyPickTimes() { 61 mPickResult.setRepeatedPickTimes(4); 62 assertThat(mPickResult.getRepeatedPickTimes()).isEqualTo(4); 63 } 64 65 @Test testFileUri()66 public void testFileUri() { 67 Uri fakeUri = new Uri.Builder().authority("test").appendPath("path").build(); 68 mPickResult.setFileUri(fakeUri); 69 assertThat(mPickResult.getFileUri()).isEqualTo(fakeUri); 70 } 71 } 72