summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Joanne Chung <joannechung@google.com> 2020-03-25 02:16:05 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-03-25 02:16:05 +0000
commit3361dd2ad3a1485b37052cdeb716607dff19900a (patch)
treecca88bcdfdecde874f07e6c3078e603d371f9821
parenta5f08bda7e8bec04e320bff30470199759af716d (diff)
parent3015adf9c4f5195281b65a290aeff2e99230618e (diff)
Merge "Fix ContentCaptureManagerTest test fail." into rvc-dev
-rw-r--r--core/tests/coretests/src/android/view/contentcapture/ContentCaptureManagerTest.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/core/tests/coretests/src/android/view/contentcapture/ContentCaptureManagerTest.java b/core/tests/coretests/src/android/view/contentcapture/ContentCaptureManagerTest.java
index ba27fac05a99..eae1bbc930d4 100644
--- a/core/tests/coretests/src/android/view/contentcapture/ContentCaptureManagerTest.java
+++ b/core/tests/coretests/src/android/view/contentcapture/ContentCaptureManagerTest.java
@@ -15,11 +15,12 @@
*/
package android.view.contentcapture;
+import static org.mockito.Mockito.mock;
import static org.testng.Assert.assertThrows;
+import android.content.ContentCaptureOptions;
import android.content.Context;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -37,16 +38,20 @@ public class ContentCaptureManagerTest {
@Mock
private Context mMockContext;
- private ContentCaptureManager mManager;
-
- @Before
- public void before() {
- mManager = new ContentCaptureManager(mMockContext, /* service= */ null,
- /* options= */ null);
+ @Test
+ public void testConstructor_invalidParametersThrowsException() {
+ assertThrows(NullPointerException.class,
+ () -> new ContentCaptureManager(mMockContext, /* service= */ null, /* options= */
+ null));
}
@Test
- public void testRemoveData_invalid() {
- assertThrows(NullPointerException.class, () -> mManager.removeData(null));
+ public void testRemoveData_invalidParametersThrowsException() {
+ final IContentCaptureManager mockService = mock(IContentCaptureManager.class);
+ final ContentCaptureOptions options = new ContentCaptureOptions(null);
+ final ContentCaptureManager manager =
+ new ContentCaptureManager(mMockContext, mockService, options);
+
+ assertThrows(NullPointerException.class, () -> manager.removeData(null));
}
}