I have an activity with a searchview which is under test, Everything works as expected but the tests fail.
@Override
protected void setUp() throws Exception {
super.setUp();
Intent intent = new Intent(getInstrumentation().getContext(),StartActivity.class);
startActivity(intent, null, null);
}
@SmallTest
public void testShouldCreateStartActivity() {
assertNotNull(activity);
}
The test fails because of searchManager.getSearchableInfo(activity.getComponentName()) returning null.
SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE);
SearchableInfo searchableInfo = searchManager.getSearchableInfo(activity.getComponentName());
Very frustrating to have working app code but the tests fail.