Merge "Fix ContentCaptureManagerTest test fail." into rvc-dev

This commit is contained in:
Joanne Chung
2020-03-25 02:16:05 +00:00
committed by Android (Google) Code Review

View File

@@ -15,11 +15,12 @@
*/ */
package android.view.contentcapture; package android.view.contentcapture;
import static org.mockito.Mockito.mock;
import static org.testng.Assert.assertThrows; import static org.testng.Assert.assertThrows;
import android.content.ContentCaptureOptions;
import android.content.Context; import android.content.Context;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@@ -37,16 +38,20 @@ public class ContentCaptureManagerTest {
@Mock @Mock
private Context mMockContext; private Context mMockContext;
private ContentCaptureManager mManager; @Test
public void testConstructor_invalidParametersThrowsException() {
@Before assertThrows(NullPointerException.class,
public void before() { () -> new ContentCaptureManager(mMockContext, /* service= */ null, /* options= */
mManager = new ContentCaptureManager(mMockContext, /* service= */ null, null));
/* options= */ null);
} }
@Test @Test
public void testRemoveData_invalid() { public void testRemoveData_invalidParametersThrowsException() {
assertThrows(NullPointerException.class, () -> mManager.removeData(null)); 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));
} }
} }