import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestFactory;
public class StudentTest {
/*объект тестового класса Student*/
@TestFactory
Stream<DynamicTest> dynamicTestsGetters() {
Student[] studentsObjects = {new Student("Alexandr", "Ivanov", 20), new Student("Vladimir", "Petrov", 18), new Student("Aleksey", "Alekseev", 35)};
String[] firstNameTest= {"Alexandr", "Vladimir", "Aleksey"};
String[] lastNameTest= {"Ivanov", "Petrov", "Alekseev"};
Integer[] ageTest = {20, 18, 35};
List<DynamicTest> dynamicTests = new ArrayList<>();
for(int i=0; i < studentsObjects.length; i++) {
int j = i;
DynamicTest dynamicTestFirstName = dynamicTest("DynamicTest getFirstName("+firstNameTest[j]+")", () ->{assertEquals(firstNameTest[j],studentsObjects[j].getFirstName());});
DynamicTest dynamicTestLastName = dynamicTest("DynamicTest getLastName("+lastNameTest[j]+")", () ->{assertEquals(lastNameTest[j],studentsObjects[j].getLastName());});
DynamicTest dynamicTestAge = dynamicTest("DynamicTest getAge("+ageTest[j]+")", () ->{assertEquals(ageTest[j],studentsObjects[j].getAge());});
dynamicTests.add(dynamicTestFirstName);
dynamicTests.add(dynamicTestLastName);
dynamicTests.add(dynamicTestAge);
}
return dynamicTests.stream();
}
}