Android.os.BaseBundle no se burla

Estoy tratando de escribir caso de prueba de unidad para uno de los métodos estáticos.

protected static ScheduleCheck createScheduleCheck(Bundle extra){ long assetId = extra.getLong(ScheduleCheckRecommendationService.EXTRA_ASSET_ID); int hour = extra.getInt(ScheduleCheckRecommendationService.EXTRA_SCHEDULE_CHECK_HOUR); int minute = extra.getInt(ScheduleCheckRecommendationService.EXTRA_SCHEDULE_CHECK_MINUTE); int ampm = extra.getInt(ScheduleCheckRecommendationService.EXTRA_SCHEDULE_CHECK_AMPM); long landmarkId = extra.getLong(ScheduleCheckRecommendationService.EXTRA_LANDMARK_ID); final ArrayList<Integer> weekday = extra.getIntegerArrayList(ScheduleCheckRecommendationService.EXTRA_WEEK_DAY_LIST); final Set<Weekday> weekdaySet = convertWeedays(weekday); // Adjust hour. hour = hour + 12 * ampm; ScheduleCheck scheduleCheck = new ScheduleCheck(); scheduleCheck.setAssetId(assetId); scheduleCheck.setTimeToFireInDisplayTimezone((int) FinderUtils.getTimeInSeconds(hour, minute)); scheduleCheck.setLandmarkId(landmarkId); scheduleCheck.setWeekdaysToFireInDisplayTimezone(weekdaySet); return scheduleCheck; } 

Caso de prueba unitario:

 public class ScheduleCheckRecommendationReceiverTest { private static final long ASSET_ID = 1L; private static final int HOUR = 10; private static final int MINUTE = 10; private static final int AM = 0; private static final int PM = 1; private static final long LANDMARK_ID = 10L; private static final ArrayList<Integer> calendarWeekday = new ArrayList(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); private static final Set<Weekday> weekdaySet = new HashSet<>(Arrays.asList(Weekday.SUNDAY, Weekday.MONDAY, Weekday.TUESDAY, Weekday.WEDNESDAY, Weekday.THURSDAY, Weekday.FRIDAY, Weekday.SATURDAY)); private Bundle extra; private ScheduleCheck scheduleCheck; @Before public void setup(){ extra = new Bundle(); extra.putLong(ScheduleCheckRecommendationService.EXTRA_ASSET_ID, ASSET_ID); extra.putInt(ScheduleCheckRecommendationService.EXTRA_SCHEDULE_CHECK_HOUR, HOUR); extra.putInt(ScheduleCheckRecommendationService.EXTRA_SCHEDULE_CHECK_MINUTE, MINUTE); extra.putInt(ScheduleCheckRecommendationService.EXTRA_SCHEDULE_CHECK_AMPM, PM); extra.putLong(ScheduleCheckRecommendationService.EXTRA_LANDMARK_ID, LANDMARK_ID); extra.putIntegerArrayList(ScheduleCheckRecommendationService.EXTRA_WEEK_DAY_LIST, calendarWeekday); // Schedule check scheduleCheck = new ScheduleCheck(); scheduleCheck.setAssetId(ASSET_ID); scheduleCheck.setTimeToFireInDisplayTimezone((int) FinderUtils.getTimeInSeconds(HOUR, MINUTE)); scheduleCheck.setLandmarkId(LANDMARK_ID); scheduleCheck.setWeekdaysToFireInDisplayTimezone(weekdaySet); } @After public void tearDown(){ } @Test public void testCreateScheduleCheckOk(){ ScheduleCheck actualScheduleCheck = ScheduleCheckRecommendationReceiver.createScheduleCheck(extra); // verification steps ... ... ... } } 

Pero cuando trato de ejecutar los casos de prueba utilizando el comando ./gradlew test obtiene el siguiente error.

  com.locationlabs.finder.android.core.services.ScheduleCheckRecommendationReceiverTest > testCreateScheduleCheckOk FAILED java.lang.RuntimeException: Method putLong in android.os.BaseBundle not mocked. See http://g.co/androidstudio/not-mocked for details. at android.os.BaseBundle.putLong(BaseBundle.java) at com.locationlabs.finder.android.core.services.ScheduleCheckRecommendationReceiverTest.setup(ScheduleCheckRecommendationReceiverTest.java:39) 1 test completed, 1 failed 

Traté de visitar el enlace ( http://g.co/androidstudio/not-mocked ) proporcionado en el mensaje de error e incluía la solución sugerida, pero no funcionó en absoluto y recibí un error completamente diferente.

 com.locationlabs.finder.android.core.services.ScheduleCheckRecommendationReceiverTest > testCreateScheduleCheckOk FAILED java.lang.UnsatisfiedLinkError: android.os.SystemClock.elapsedRealtime()J at android.os.SystemClock.elapsedRealtime(Native Method) at com.locationlabs.util.debug.FifoLog.log(FifoLog.java:97) at com.locationlabs.util.debug.Log.delegatePrintln(Log.java:238) at com.locationlabs.util.debug.Log.doLog(Log.java:198) at com.locationlabs.util.debug.Log.i(Log.java:268) at com.locationlabs.finder.android.core.util.WMCache.getInstance(WMCache.java:52) at com.locationlabs.finder.android.core.model.persister.AbstractPersister.load(AbstractPersister.java:31) at com.locationlabs.finder.android.core.manager.AccountDataManager.cachedAccountData(AccountDataManager.java:32) at com.locationlabs.finder.android.core.util.DateUtil.getFinderTimezone(DateUtil.java:52) at com.locationlabs.finder.android.core.util.DateUtil.getFinderOffset(DateUtil.java:72) at com.locationlabs.finder.android.core.model.ScheduleCheck.setTimeToFireInDisplayTimezone(ScheduleCheck.java:295) at com.locationlabs.finder.android.core.services.ScheduleCheckRecommendationReceiverTest.setup(ScheduleCheckRecommendationReceiverTest.java:49) 

No estoy seguro de cómo solucionar este problema y por qué estoy recibiendo este error.

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.