MapIntent extends BaseIntent<MapIntent> { public MapIntent zoomLevel(@IntRange(from = ZOOM_LEVEL_MIN, to = ZOOM_LEVEL_MAX) final int level) { this.zoomLevel = Math.max(ZOOM_LEVEL_MIN, Math.min(ZOOM_LEVEL_MAX, level)); return this; }  MapIntent location(@FloatRange(from = LAT_MIN, to = LAT_MAX) final double lat, @FloatRange(from = LNG_MIN, to = LNG_MAX) final double lng); @FloatRange(from = LAT_MIN, to = LAT_MAX) double lat(); @FloatRange(from = LNG_MIN, to = LNG_MAX) double lng(); MapIntent locationQuery(@Nullable final String query); @NonNull String locationQuery(); MapIntent zoomLevel(@IntRange(from = ZOOM_LEVEL_MIN, to = ZOOM_LEVEL_MAX) final int level); @IntRange(from = 0, to = ZOOM_LEVEL_MAX) int zoomLevel(); MapIntent label(@Nullable final String label); @NonNull String label(); static final String URI_SCHEME; static final double LAT_MIN; static final double LAT_MAX; static final double LNG_MIN; static final double LNG_MAX; static final int ZOOM_LEVEL_MIN; static final int ZOOM_LEVEL_MAX; }
@Test public void testZoomLevel() { final MapIntent intent = new MapIntent(); intent.zoomLevel(12); assertThat(intent.zoomLevel(), is(12)); }
@Test public void testZoomLevelOutOfRange() { final MapIntent intent = new MapIntent(); intent.zoomLevel(-3); assertThat(intent.zoomLevel(), is(MapIntent.ZOOM_LEVEL_MIN)); intent.zoomLevel(50); assertThat(intent.zoomLevel(), is(MapIntent.ZOOM_LEVEL_MAX)); }