Skip to content

Instantly share code, notes, and snippets.

@kikers25
Last active August 29, 2015 14:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kikers25/5812bd9e35192fe0229d to your computer and use it in GitHub Desktop.
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