Skip to content

Fix and strengthen tests in CollectionToCollectionConverterTests - #37254

Open
noojung wants to merge 1 commit into
spring-projects:mainfrom
noojung:fix/collection-converter-tests
Open

Fix and strengthen tests in CollectionToCollectionConverterTests#37254
noojung wants to merge 1 commit into
spring-projects:mainfrom
noojung:fix/collection-converter-tests

Conversation

@noojung

@noojung noojung commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Despite their names, convertEmptyVector_shouldReturnEmptyArrayList() and convertNonEmptyVector_shouldReturnNonEmptyArrayList() had identical logic:

	@Test
	void convertEmptyVector_shouldReturnEmptyArrayList() {
		Vector<String> vector = new Vector<>();
		vector.add("Element");
		testCollectionConversionToArrayList(vector);
	}

	@Test
	void convertNonEmptyVector_shouldReturnNonEmptyArrayList() {
		Vector<String> vector = new Vector<>();
		vector.add("Element");
		testCollectionConversionToArrayList(vector);
	}

As a result, the empty Vector case was never tested.

Update convertEmptyVector_shouldReturnEmptyArrayList() to use an empty Vector and assert that the result is an empty ArrayList. In convertNonEmptyVector_shouldReturnNonEmptyArrayList(), explicitly assert that the result is a non-empty ArrayList.

Also strengthen collectionsEmptyList() to verify that conversion returns the original instance, in addition to checking that it completes without an exception.

Signed-off-by: Hyunwoo Jung <hyunwoojung@kakao.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 7, 2026
@bclozel bclozel added the in: core Issues in core modules (aop, beans, core, context, expression) label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core Issues in core modules (aop, beans, core, context, expression) status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants