Skip to content
Snippets Groups Projects
Commit 43da7b5d authored by Andreas's avatar Andreas Committed by Harry Linrui XU
Browse files

Fixed FileHandling tests failing

parent 84b2a44a
No related branches found
No related tags found
10 merge requests!43Merging frontend-testing into master,!38"Made progressbar dynamic in accordance to spending. Added balance field....,!37Made the sub progress bars respond to changes in expense,!32Added input validation to add dialog boxes.,!30Redesigned scenes,!29Redesigned scenes,!28Redesigned scenes,!26Redesigned Main menu and expense/income windows,!24Merging frontend-testing with master,!23Merging frontend-testing and master
......@@ -73,7 +73,7 @@ public class FileHandling{
boolean reoccuring = false;
IncomeCategory incomeCategory = null;
try (BufferedReader br = new BufferedReader(new FileReader(filePath + fileTitle + fileType))) {
String line;
String line = br.readLine();
String nextLine = br.readLine();
while ((line = nextLine) != null) {
nextLine = br.readLine();
......@@ -92,13 +92,13 @@ public class FileHandling{
case "STUDENT_LOAN" -> IncomeCategory.STUDENT_LOAN;
default -> IncomeCategory.SALARY;
};
}
if(line.isEmpty() || (nextLine == null)) {
} if(line.isEmpty() || (nextLine == null)) {
if(description.equals("")){
incomeRegister.addItem(new Income(amount, reoccuring, incomeCategory, date));
} else{
incomeRegister.addItem(new Income(description, amount, reoccuring, incomeCategory, date));
}
nextLine=br.readLine();
description = "";
}
}
......@@ -121,7 +121,7 @@ public class FileHandling{
boolean reoccuring = false;
ExpenseCategory expenseCategory = null;
try (BufferedReader br = new BufferedReader(new FileReader(filePath + fileTitle + fileType))) {
String line;
String line = br.readLine();
String nextLine = br.readLine();
while ((line = nextLine) != null) {
nextLine = br.readLine();
......@@ -148,6 +148,7 @@ public class FileHandling{
} else {
expenseRegister.addItem(new Expense(description, amount, reoccuring, expenseCategory, date));
}
nextLine = br.readLine();
description = "";
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment