DataSource implements IConfig, Serializable { @NonNull public static Builder builder(@NonNull String providerName, @NonNull String version) { Objects.requireNonNull(providerName, "providerName"); Objects.requireNonNull(version, "version"); return new Builder(providerName, version); } @VisibleForTesting  DataSource(@NonNull String providerName, @NonNull String version, @NonNull ImmutableSortedMap<String, String> params); @NonNull String getProviderName(); @NonNull String getVersion(); @Override SortedMap<String, String> getParams(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @NonNull Builder toBuilder(); @NonNull static DataSource of(@NonNull String providerName, @NonNull String version); @NonNull static DataSource of(@NonNull String providerName, @NonNull String version, @NonNull String key, @NonNull String value); @NonNull static DataSource deepCopyOf(@NonNull String providerName, @NonNull String version, @NonNull Map<String, String> params); @NonNull static Builder builder(@NonNull String providerName, @NonNull String version); @Deprecated @NonNull static Builder builder(@NonNull DataSource dataSource); static Formatters.@NonNull Formatter<DataSource> xmlFormatter(boolean formattedOutput); static Parsers.@NonNull Parser<DataSource> xmlParser(); static Formatters.@NonNull Formatter<DataSource> uriFormatter(); static Parsers.@NonNull Parser<DataSource> uriParser();  }
@Test public void testBuilder() { assertThat(ZERO.toBuilder().build()).isEqualTo(ZERO); assertThat(ONE.toBuilder().build()).isEqualTo(ONE); DataSource.Builder builder = newSample().toBuilder(); assertThat(builder.build()) .isEqualTo(newSample()) .isNotSameAs(newSample()) .isEqualTo(builder.build()) .isNotSameAs(builder.build()); assertThat(builder.put(K1, "hello").build().get(K1)).isEqualTo("hello"); assertThat(builder.put(K1, true).build().get(K1)).isEqualTo("true"); assertThat(builder.put(K1, 123).build().get(K1)).isEqualTo("123"); assertThat(builder.clear().build().getParams()).isEmpty(); }