mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:30:28 +00:00
Polish contribution
See gh-37254
This commit is contained in:
+14
-11
@@ -162,23 +162,20 @@ class CollectionToCollectionConverterTests {
|
||||
|
||||
@Test
|
||||
void convertEmptyVector_shouldReturnEmptyArrayList() {
|
||||
Vector<String> vector = new Vector<>();
|
||||
CollectionToCollectionConverter converter = new CollectionToCollectionConverter(new GenericConversionService());
|
||||
Object convertedValue = converter.convert(
|
||||
vector, TypeDescriptor.forObject(vector), TypeDescriptor.valueOf(ArrayList.class));
|
||||
assertThat(convertedValue).isInstanceOf(ArrayList.class);
|
||||
assertThat(convertedValue).asInstanceOf(LIST).isEmpty();
|
||||
Object convertedValue = convertVectorToArrayList(new Vector<>());
|
||||
assertThat(convertedValue)
|
||||
.isInstanceOf(ArrayList.class)
|
||||
.asInstanceOf(LIST).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertNonEmptyVector_shouldReturnNonEmptyArrayList() {
|
||||
Vector<String> vector = new Vector<>();
|
||||
vector.add("Element");
|
||||
CollectionToCollectionConverter converter = new CollectionToCollectionConverter(new GenericConversionService());
|
||||
Object convertedValue = converter.convert(
|
||||
vector, TypeDescriptor.forObject(vector), TypeDescriptor.valueOf(ArrayList.class));
|
||||
assertThat(convertedValue).isInstanceOf(ArrayList.class);
|
||||
assertThat(convertedValue).asInstanceOf(LIST).isNotEmpty();
|
||||
Object convertedValue = convertVectorToArrayList(vector);
|
||||
assertThat(convertedValue)
|
||||
.isInstanceOf(ArrayList.class)
|
||||
.asInstanceOf(LIST).containsOnly("Element");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -255,6 +252,12 @@ class CollectionToCollectionConverterTests {
|
||||
}
|
||||
|
||||
|
||||
private static Object convertVectorToArrayList(Vector<String> vector) {
|
||||
CollectionToCollectionConverter converter = new CollectionToCollectionConverter(new GenericConversionService());
|
||||
return converter.convert(vector, TypeDescriptor.forObject(vector), TypeDescriptor.valueOf(ArrayList.class));
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<Integer> scalarListTarget;
|
||||
|
||||
public List<Integer> emptyListTarget;
|
||||
|
||||
Reference in New Issue
Block a user