@SmallTest public void testDoesNotSaveOruxMapsOnGPSStopWhenPreferenceDisabled() throws Exception { when(_sharedPreferences.getString("ORUXMAPS_AUTO", "disable")).thenReturn("disable"); _command.execute(_app); _bus.post(new GPSStatus(BaseStatus.Status.STOPPED)); verify(_mockOruxMaps, timeout(2000).times(0)).stopRecord(); }
@SmallTest public void testNewSegmentOruxMapsOnGPSStartWhenPreferenceNewSegment() throws Exception { when(_sharedPreferences.getString("ORUXMAPS_AUTO", "disable")).thenReturn("new_segment"); _command.execute(_app); _bus.post(new GPSStatus(BaseStatus.Status.STARTED)); verify(_mockOruxMaps, timeout(2000).times(1)).startRecordNewSegment(); }
@SmallTest public void testNewSegmentOruxMapsOnGPSStartWhenPreferenceAutoAndLastStartLess12HoursAgo() throws Exception { when(_sharedPreferences.getLong("GPS_LAST_START", 0)).thenReturn((long) 0); when(_mockTime.getCurrentTimeMilliseconds()).thenReturn((long) 12); when(_sharedPreferences.getString("ORUXMAPS_AUTO", "disable")).thenReturn("auto"); _command.execute(_app); _bus.post(new GPSStatus(BaseStatus.Status.STARTED)); verify(_mockOruxMaps, timeout(2000).times(1)).startRecordNewSegment(); }