Skip to content

Commit 14960fb

Browse files
committed
Added new constructor to UserDatabase
1 parent 65cadb3 commit 14960fb

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/UserDatabase.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@
44
public class UserDatabase implements UserExists, UserRetriever, UserCreator, IRetrieveList{
55
File accounts;
66
List<User> accountList;
7-
public UserDatabase(File accounts){
7+
public UserDatabase(){
8+
this.accounts = new File("TestUserDatabase3.csv");
9+
this.accountList = this.getList();
10+
}
11+
public UserDatabase(File accounts) {
12+
if (!accounts.exists()) {
13+
try {
14+
accounts.createNewFile();
15+
} catch (IOException e) {
16+
throw new RuntimeException(e);
17+
}
18+
}
819
this.accounts = accounts;
920
this.accountList = this.getList();
1021
}

0 commit comments

Comments
 (0)