Code example for IsolatedContext

        mMockProvider = new MockProvider();
        mMockAlarmManager = new MockAlarmManager(mContext);
        MockContentResolver mockResolver = new MockContentResolver();
        mockResolver.addProvider(CalendarContract.AUTHORITY, mMockProvider);
        mIsolatedContext = new IsolatedContext(mockResolver, mContext);
    public void testNoEvents() { 
        AlarmScheduler.scheduleNextAlarm(mIsolatedContext, mMockAlarmManager,
                BATCH_SIZE, System.currentTimeMillis());
    public void testNonAllDayEvent() { 
        // Set up mock test data. 
        long currentMillis = System.currentTimeMillis();
        long startMillis = currentMillis + DateUtils.HOUR_IN_MILLIS;
        int reminderMin = 10;
        mMockProvider.addEventInfo(1, false, startMillis, reminderMin);
Connect your IDE to all the code out there  Get Codota for Java