|
|
@ -17,6 +17,7 @@
|
|
|
|
package org.springframework.boot.context.properties.bind;
|
|
|
|
package org.springframework.boot.context.properties.bind;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.LinkedList;
|
|
|
|
import java.util.LinkedList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
@ -289,4 +290,15 @@ public class CollectionBinderTests {
|
|
|
|
List<String> values = result.stream().map(JavaBean::getValue).collect(Collectors.toList());
|
|
|
|
List<String> values = result.stream().map(JavaBean::getValue).collect(Collectors.toList());
|
|
|
|
assertThat(values).containsExactly("a", "b", "c");
|
|
|
|
assertThat(values).containsExactly("a", "b", "c");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void bindToImmutableCollectionShouldReturnPopulatedCollection() throws Exception {
|
|
|
|
|
|
|
|
MockConfigurationPropertySource source = new MockConfigurationPropertySource();
|
|
|
|
|
|
|
|
source.put("foo.values", "a,b,c");
|
|
|
|
|
|
|
|
this.sources.add(source);
|
|
|
|
|
|
|
|
Set<String> result = this.binder.bind("foo.values",
|
|
|
|
|
|
|
|
STRING_SET.withExistingValue(Collections.emptySet())).get();
|
|
|
|
|
|
|
|
assertThat(result).hasSize(3);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|