@Test
public void checksSendEventNotCalledWhenAltitudeNaN() throws Exception {
Context mockedContext = mock(Context.class);
Intent mockedIntent = mock(Intent.class);
when(mockedIntent.getStringExtra(eq("location_received"))).thenReturn("onLocation");
Bundle mockedBundle = mock(Bundle.class);
when(mockedIntent.getExtras()).thenReturn(mockedBundle);
Location mockedLocation = mock(Location.class);
when(mockedBundle.get(eq(LocationManager.KEY_LOCATION_CHANGED))).thenReturn(mockedLocation);
when(mockedLocation.getAltitude()).thenReturn(Double.NaN);
EventSender mockedEventSender = mock(EventSender.class);
LocationReceiver theLocationReceiver = new LocationReceiver(mockedEventSender);
theLocationReceiver.onReceive(mockedContext, mockedIntent);
verify(mockedEventSender, never()).send(any(LocationEvent.class));
}
LocationReceiverTest.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:mapbox-events-android
作者:
评论列表
文章目录