MraidNativeCommandHandler { boolean isCalendarAvailable(Context context) { Intent calendarIntent = new Intent(Intent.ACTION_INSERT).setType(ANDROID_CALENDAR_CONTENT_TYPE); return VersionCode.currentApiLevel().isAtLeast(VersionCode.ICE_CREAM_SANDWICH) && IntentUtils.deviceCanHandleIntent(context, calendarIntent); }  boolean isStorePictureSupported(Context context); static final String ANDROID_CALENDAR_CONTENT_TYPE; }
@Config(reportSdk = Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Test public void isCalendarAvailable_atLeastIcs_shouldReturnTrue() throws Exception { context = createMockContextWithSpecificIntentData(null, null, ANDROID_CALENDAR_CONTENT_TYPE, "android.intent.action.INSERT"); assertThat(subject.isCalendarAvailable(context)).isTrue(); }
@Config(reportSdk = Build.VERSION_CODES.HONEYCOMB_MR2) @Test public void isCalendarAvailable_beforeIcs_shouldReturnFalse() throws Exception { context = createMockContextWithSpecificIntentData(null, null, ANDROID_CALENDAR_CONTENT_TYPE, "android.intent.action.INSERT"); assertThat(subject.isCalendarAvailable(context)).isFalse(); }
@Config(reportSdk = Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Test public void isCalendarAvailable_atLeastIcs_butCanNotAcceptIntent_shouldReturnFalse() throws Exception { context = createMockContextWithSpecificIntentData(null, null, "vnd.android.cursor.item/NOPE", "android.intent.action.INSERT"); assertThat(subject.isCalendarAvailable(context)).isFalse(); }