Instantly share code, notes, and snippets.

@kikers25 /4_User.java Secret
Last active Aug 29, 2015

Embed
What would you like to do?
Constructor Injection 2
public class User {
public boolean isEmpty() {
return false;
}
}
public class NoUser extends User {
@Override
public boolean isEmpty() {
return true;
}
}
public class FakeUserDAO implements UserDAO {
@Override
public User findUserBy(Email email) {
return new NoUser();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment