Last active
December 24, 2017 06:45
-
-
Save Adrianvdh/1e6c73a05587fa536f105c2f702ae3d4 to your computer and use it in GitHub Desktop.
Tdd examples from http://scholarcoder.com/1392/ttd-intro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserService { | |
List<User> users = new ArrayList<>(); | |
{ | |
User user = new User(); | |
user.username = "adrianvdh"; | |
user.password = "hello123"; | |
users.add(user); | |
} | |
public User authenticate(String username, String password) { | |
User foundUser = null; | |
for (User userInCollection : users) { | |
if (userInCollection.username.equals(username)) { | |
foundUser = userInCollection; | |
break; | |
} | |
} | |
return foundUser; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment