RetroProxy { public HttpUrl baseUrl() { return baseUrl; } private  RetroProxy(RequestQueue requestQueue, HttpUrl baseUrl, List<Factory> converters,
                       boolean validateEagerly, boolean execManually); @SuppressWarnings("unchecked") // Single-interface proxy creation guarded by parameter safety. T create(final Class<T> service); RequestQueue requestQueue(); boolean execManually(); HttpUrl baseUrl(); List<Factory> converterFactories(); Converter<?, NetworkRequest> requestConverter(Type type, Annotation[] annotations); Converter<NetworkResponse, ?> responseConverter(Type type, Annotation[] annotations);  }
@Test public void baseUrlNullThrows() { try { new RetroProxy.Builder().baseUrl((String) null); fail(); } catch (NullPointerException e) { assertThat(e).hasMessage("baseUrl == null"); } try { new RetroProxy.Builder().baseUrl((HttpUrl) null); fail(); } catch (NullPointerException e) { assertThat(e).hasMessage("baseUrl == null"); } }
@Test public void baseUrlInvalidThrows() { try { new RetroProxy.Builder().baseUrl("ftp: fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("Illegal URL: ftp: } }
@Test public void baseUrlStringPropagated() { RetroProxy retroProxy = new RetroProxy.Builder() .baseUrl("http: .build(); HttpUrl baseUrl = retroProxy.baseUrl(); assertThat(baseUrl).isNotNull(); assertThat(baseUrl.url().toString()).isEqualTo("http: }
@Test public void baseHttpUrlPropagated() { HttpUrl url = HttpUrl.parse("http: RetroProxy retroProxy = new RetroProxy.Builder() .baseUrl(url) .build(); HttpUrl baseUrl = retroProxy.baseUrl(); assertThat(baseUrl).isNotNull(); assertThat(baseUrl).isSameAs(url); }