samedi 3 octobre 2015

how to mock method which invoke collection method and this collection has not setter?

I have following class:

public class UsersHolder {
    private Set<User> users = new HashSet<>();

    public void addUser(User user) {
        users.add(user);
    }
    ...
}

users have not setter method

Is there way to test addUser method?

Aucun commentaire:

Enregistrer un commentaire