diff --git a/spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/Person.java b/spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/Person.java index f0fd0e955e..097af2ad1c 100644 --- a/spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/Person.java +++ b/spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/Person.java @@ -8,4 +8,8 @@ public class Person { this.name = name; } + public String getName() { + return this.name; + } + } \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/SpringJUnitConfigurationParameterizedTest.java b/spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/SpringJUnitConfigurationUnitTest.java similarity index 69% rename from spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/SpringJUnitConfigurationParameterizedTest.java rename to spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/SpringJUnitConfigurationUnitTest.java index 642a9c9f64..79486e6b3e 100644 --- a/spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/SpringJUnitConfigurationParameterizedTest.java +++ b/spring-boot-modules/spring-boot-3/src/test/java/com/baeldung/springjunitconfiguration/SpringJUnitConfigurationUnitTest.java @@ -1,18 +1,21 @@ package com.baeldung.springjunitconfiguration; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.context.support.AnnotationConfigContextLoader; import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; + @SpringJUnitConfig(classes = TestConfig.class, loader = AnnotationConfigContextLoader.class) -public class SpringJUnitConfigurationParameterizedTest { +public class SpringJUnitConfigurationUnitTest { @ParameterizedTest @ValueSource(strings = { "Dilbert", "Wally" }) - void people(String name, @Autowired List people) { + void givenPeopleList_whenSetPeopleWithName_thenListContainsOnePerson(String name, @Autowired List people) { assertThat(people.stream() .map(Person::getName) .filter(name::equals)).hasSize(1);