Skip to content

Expected value is not created in Spring tests #2069

Closed
@EgorkaKulikov

Description

@EgorkaKulikov

To Reproduce

All mentioned classes and methods are taken from this project https://github.com/spring-projects/spring-petclinic

Generate tests for method Pet.getType

Expected behavior

Compilable tests are generated.

Actual behavior

Generated test looks as follows:

	@Test
	public void testGetType1() throws Exception {
		PetType petType = ((PetType) createInstance("org.springframework.samples.petclinic.owner.PetType"));

		PetType actual = pet.getType();

		// java.util.LinkedHashSet is iterable or Map, use outer deep equals to iterate over
		assertTrue(deepEquals(linkedHashSet, actual));
	}

Variable linkedHashSet was never declared.
It is not obvious why HashSets are used.

Metadata

Metadata

Assignees

Labels

comp-codegenIssue is related to code generatorcomp-springIssue is related to Spring projects supportctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions