@Test public void shouldGetURLSchemeFromServerDefinition() { Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl(null))).isEqualTo("http"); Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl(""))).isEqualTo("http"); Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl("http: Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl("http: Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl("https: Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl("/v1"))).isEqualTo("http"); Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl("http is awesome!"))).isEqualTo("http"); Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl("Something completely different"))).isEqualTo("http"); Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl("{scheme}: Assertions.assertThat(Oas30ModelHelper.getScheme(getServerWithUrl("{scheme}: }
static String getScheme(Server server) { String serverUrl = resolveUrl(server); if (serverUrl.startsWith(HTTP)) { try { return new URL(serverUrl).getProtocol(); } catch (MalformedURLException e) { LOG.warn(String.format("Unable to determine base path from server URL: %s", serverUrl)); } } return HTTP; }
Oas30ModelHelper { static String getScheme(Server server) { String serverUrl = resolveUrl(server); if (serverUrl.startsWith(HTTP)) { try { return new URL(serverUrl).getProtocol(); } catch (MalformedURLException e) { LOG.warn(String.format("Unable to determine base path from server URL: %s", serverUrl)); } } return HTTP; } }
Oas30ModelHelper { static String getScheme(Server server) { String serverUrl = resolveUrl(server); if (serverUrl.startsWith(HTTP)) { try { return new URL(serverUrl).getProtocol(); } catch (MalformedURLException e) { LOG.warn(String.format("Unable to determine base path from server URL: %s", serverUrl)); } } return HTTP; } private  Oas30ModelHelper(); }
Oas30ModelHelper { static String getScheme(Server server) { String serverUrl = resolveUrl(server); if (serverUrl.startsWith(HTTP)) { try { return new URL(serverUrl).getProtocol(); } catch (MalformedURLException e) { LOG.warn(String.format("Unable to determine base path from server URL: %s", serverUrl)); } } return HTTP; } private  Oas30ModelHelper();  }
Oas30ModelHelper { static String getScheme(Server server) { String serverUrl = resolveUrl(server); if (serverUrl.startsWith(HTTP)) { try { return new URL(serverUrl).getProtocol(); } catch (MalformedURLException e) { LOG.warn(String.format("Unable to determine base path from server URL: %s", serverUrl)); } } return HTTP; } private  Oas30ModelHelper();  static final String HTTP; }