use of com.stackify.daos.UserDAO in project tutorials by eugenp.
the class DynamicTests method dynamicUserTestCollection.
@TestFactory
public Stream<DynamicTest> dynamicUserTestCollection() {
List<User> inputList = Arrays.asList(new User("john@yahoo.com", "John"), new User("ana@yahoo.com", "Ana"));
Function<User, String> displayNameGenerator = (input) -> "Saving user: " + input;
UserDAO userDAO = new UserDAO();
ThrowingConsumer<User> testExecutor = (input) -> {
userDAO.add(input);
assertNotNull(userDAO.findOne(input.getEmail()));
};
return DynamicTest.stream(inputList.iterator(), displayNameGenerator, testExecutor);
}
Aggregations