protected static User newUser(String username, String email, Calendar since, Boolean active) { User user = new User(username); user.setActive(Boolean.TRUE.equals(active)); user.setEmail(email); user.setSince(since); return user; }
protected User getUser(String username) { for (User user : TEST_USERS) { if (user.getUsername().equals(username)) { return user; } } return null; }
protected List<User> getUsers(String... usernames) { List<String> usernameList = Arrays.asList(usernames); List<User> users = new ArrayList<User>(usernames.length); for (User user : TEST_USERS) { if (usernameList.contains(user.getUsername())) { users.add(user); } } return users; }
protected String getKey(User user) { return (user != null ? user.getUsername() : null); }