Complete the code to create a default User object using the Object Mother pattern.
User user = UserMother.[1]();The method getDefaultUser() is the standard naming in the Object Mother pattern to provide a default object.
Complete the code to assert that the User object created by the Object Mother has the expected default name.
assertEquals("John Doe", user.[1]());
getId() or getEmail() which do not return the name.The getName() method returns the user's name, which should match the default name set by the Object Mother.
Fix the error in the Object Mother method that creates a User with a custom email.
public static User createUserWithEmail(String email) {
return new User("John Doe", [1]);
}userEmail.The parameter email should be passed directly to the User constructor, not a string literal or method call.
Fill both blanks to create a User with a custom name and default email using the Object Mother pattern.
public static User [1](String name) { return new User(name, [2]); }
The method name should indicate creating a user with a custom name, and the email should be the default email string.
Fill all three blanks to create a map of User names to their emails for users with names longer than 5 characters.
Map<String, String> userMap = users.stream()
.filter(user -> user.getName().length() [1] 5)
.collect(Collectors.toMap(
user -> user.[2](),
user -> user.[3]()
));< instead of > in the filter.getName() and getEmail() in the map.The filter keeps users with names longer than 5 characters using >. The map keys are user names (getName()) and values are emails (getEmail()).