DefaultAirMapViewBuilder { public AirMapViewBuilder builder() { if (isNativeMapSupported) { return new NativeAirMapViewBuilder(); } return getWebMapViewBuilder(); } DefaultAirMapViewBuilder(Context context);  DefaultAirMapViewBuilder(Context context, boolean isNativeMapSupported); AirMapViewBuilder builder(); AirMapViewBuilder builder(AirMapViewTypes mapType);  }
@Test public void shouldReturnNativeAirMapViewByDefault() { DefaultAirMapViewBuilder factory = new DefaultAirMapViewBuilder(null, true); assertThat(factory.builder(), instanceOf(NativeAirMapViewBuilder.class)); }
@Test public void shouldReturnWebAirMapViewIfDefaultNotSupported() { DefaultAirMapViewBuilder factory = new DefaultAirMapViewBuilder(null, false); assertThat(factory.builder(), instanceOf(WebAirMapViewBuilder.class)); }
@Test public void shouldReturnNativeAirMapViewWhenRequestedExplicitly() { DefaultAirMapViewBuilder factory = new DefaultAirMapViewBuilder(null, true); AirMapViewBuilder builder = factory.builder(AirMapViewTypes.NATIVE); assertThat(builder, instanceOf(NativeAirMapViewBuilder.class)); }
@Test(expected = UnsupportedOperationException.class) public void shouldThrowWhenRequestedNativeWebViewAndNotSupported() { DefaultAirMapViewBuilder factory = new DefaultAirMapViewBuilder(null, false); factory.builder(AirMapViewTypes.NATIVE); }
@Test public void shouldReturnWebAirMapViewWhenRequestedExplicitly() { DefaultAirMapViewBuilder factory = new DefaultAirMapViewBuilder(null, false); AirMapViewBuilder builder = factory.builder(AirMapViewTypes.WEB); assertThat(builder, instanceOf(WebAirMapViewBuilder.class)); }