CalendarAccessorPost40 implements CalendarAccessor { @Override public boolean enableSync(long calendarId) { final ContentValues values = new ContentValues(); values.put(CalendarContract.Calendars.SYNC_EVENTS, 1); final Uri uri = ContentUris.withAppendedId(CalendarContract.Calendars.CONTENT_URI, calendarId); return resolver.update(uri, values, null, null) == 1; } CalendarAccessorPost40(ContentResolver resolver); @Override boolean enableSync(long calendarId); @Override boolean addEntry(long calendarId, @NonNull Date when, int duration, @NonNull String title,
                            @NonNull String description); @Override @NonNull Map<String, String> getCalendars();  }
@Test public void shouldEnableSync() throws Exception { when(resolver.update(eq(Uri.parse("content: any(ContentValues.class), anyString(), any(String[].class))) .thenReturn(1); assertThat(accessor.enableSync(123)).isTrue(); }