sprint Backlog updated
[staff/due1/sed-hs15-srs-purple.git] / src / main / java / ch / bfh / ti / srs / core / DataHandlerForTests.java
1 /*
2 * Copyright (c) 2015 Berner Fachhochschule, Switzerland.
3 *
4 * Project Smart Reservation System.
5 *
6 * Distributable under GPL license. See terms of license at gnu.org.
7 */
8 package ch.bfh.ti.srs.core;
9
10 import java.util.HashSet;
11 import java.util.Set;
12
13 public class DataHandlerForTests implements DataHandler{
14 Set<User> userList = new HashSet<User>();
15
16 public DataHandlerForTests(){
17
18 }
19
20 /* (non-Javadoc)
21 * @see ch.bfh.ti.srs.core.DataHandler#findUser(java.lang.String)
22 */
23 @Override
24 public User findUser(String userName) {
25 for (User user : userList) {
26 if(user.getUserName().equals(userName)) return user;
27 }
28 return null;
29 }
30
31 /* (non-Javadoc)
32 * @see ch.bfh.ti.srs.core.DataHandler#addUser(ch.bfh.ti.srs.core.User)
33 */
34 @Override
35 public void addUser(User user) throws Exception {
36 if(user == null) throw new IllegalArgumentException("User object must not be null!");
37 userList.add(user);
38 }
39 }