@Test void fromShouldThrowWhenUUIDIsWrongFormat() { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.addProperty(LinshareConfiguration.UUID_PROPERTY, SOME_RANDOM_STRING); configuration.addProperty(LinshareConfiguration.PASSWORD_PROPERTY, SOME_RANDOM_STRING); configuration.addProperty(LinshareConfiguration.URL_PROPERTY, DEFAULT_URL); assertThatThrownBy(() -> LinshareConfiguration.from(configuration)).isInstanceOf(IllegalArgumentException.class); }
public static LinshareConfiguration from(Configuration configuration) throws MalformedURLException { return builder() .urlAsString(configuration.getString(URL_PROPERTY, null)) .basicAuthorization( configuration.getString(UUID_PROPERTY), configuration.getString(PASSWORD_PROPERTY)) .build(); }
LinshareConfiguration { public static LinshareConfiguration from(Configuration configuration) throws MalformedURLException { return builder() .urlAsString(configuration.getString(URL_PROPERTY, null)) .basicAuthorization( configuration.getString(UUID_PROPERTY), configuration.getString(PASSWORD_PROPERTY)) .build(); } }
LinshareConfiguration { public static LinshareConfiguration from(Configuration configuration) throws MalformedURLException { return builder() .urlAsString(configuration.getString(URL_PROPERTY, null)) .basicAuthorization( configuration.getString(UUID_PROPERTY), configuration.getString(PASSWORD_PROPERTY)) .build(); } @VisibleForTesting  LinshareConfiguration(URL url, UUID uuid, String password); }
LinshareConfiguration { public static LinshareConfiguration from(Configuration configuration) throws MalformedURLException { return builder() .urlAsString(configuration.getString(URL_PROPERTY, null)) .basicAuthorization( configuration.getString(UUID_PROPERTY), configuration.getString(PASSWORD_PROPERTY)) .build(); } @VisibleForTesting  LinshareConfiguration(URL url, UUID uuid, String password); static Builder.RequireUrl builder(); static LinshareConfiguration from(Configuration configuration); URL getUrl(); UUID getUuid(); String getPassword(); @Override final boolean equals(Object o); @Override final int hashCode(); }
LinshareConfiguration { public static LinshareConfiguration from(Configuration configuration) throws MalformedURLException { return builder() .urlAsString(configuration.getString(URL_PROPERTY, null)) .basicAuthorization( configuration.getString(UUID_PROPERTY), configuration.getString(PASSWORD_PROPERTY)) .build(); } @VisibleForTesting  LinshareConfiguration(URL url, UUID uuid, String password); static Builder.RequireUrl builder(); static LinshareConfiguration from(Configuration configuration); URL getUrl(); UUID getUuid(); String getPassword(); @Override final boolean equals(Object o); @Override final int hashCode(); static final String URL_PROPERTY; static final String UUID_PROPERTY; static final String PASSWORD_PROPERTY; }