Skip to content
Snippets Groups Projects
Commit 11c0a12a authored by Harry Linrui XU's avatar Harry Linrui XU
Browse files

Set filepath of test files to new directory structure

parent 434361ca
No related branches found
No related tags found
1 merge request!43Merging frontend-testing into master
......@@ -25,7 +25,7 @@ class FileHandlingBudgetTest {
@DisplayName("FileHandling budget with one BudgetItem does not throw exception")
class fileHandlingBudgetWithOneBudgetItemDoesNotThrowException{
GeneralBudget generalBudget = new GeneralBudget(1200);
String fileTitle = "oneBudgetItemTest";
String fileTitle = "testFiles/budget/oneBudgetItemTest";
@BeforeEach
void createGeneralBudget(){
......@@ -49,7 +49,7 @@ class FileHandlingBudgetTest {
@DisplayName("FileHandling budget with multiple BudgetItems does not throw exception")
class FileHandlingBudgetWithMultipleBudgetItemsDoesNotThrowException{
GeneralBudget generalBudget = new GeneralBudget(1200);
String fileTitle = "multipleBudgetItem";
String fileTitle = "testFiles/budget/multipleBudgetItem";
@BeforeEach
void createGeneralBudget(){
foodItem = new BudgetItem(500, "description", ExpenseCategory.FOOD);
......@@ -71,5 +71,4 @@ class FileHandlingBudgetTest {
assertEquals(generalBudget,FileHandlingBudget.readGeneralBudgetFromFile(fileTitle));
}
}
}
......@@ -18,8 +18,8 @@ class FileHandlingTest {
@Test
@DisplayName("isEmpty returns true if a file is empty")
void isEmptyReturnsTrueIfAFileIsEmpty() throws IOException {
FileHandling.writeItemRegisterToFile(incomeRegister, "incomeRegisterTest");
assertTrue(FileHandling.isEmpty("incomeRegisterTest"));
FileHandling.writeItemRegisterToFile(incomeRegister, "/testFiles/economics/incomeRegisterTest");
assertTrue(FileHandling.isEmpty("/testFiles/economics/incomeRegisterTest"));
}
@Test
......@@ -27,14 +27,14 @@ class FileHandlingTest {
void isEmptyReturnsFalseIfFileIsNotEmpty() throws IOException {
Income income1 = new Income("description", 59.9f, false, IncomeCategory.GIFT, LocalDate.of(2023, Month.MARCH, 3));
incomeRegister.addItem(income1);
FileHandling.writeItemRegisterToFile(incomeRegister, "incomeRegisterTest");
assertFalse(FileHandling.isEmpty("incomeRegisterTest"));
FileHandling.writeItemRegisterToFile(incomeRegister, "/testFiles/economics/incomeRegisterTest");
assertFalse(FileHandling.isEmpty("/testFiles/economics/incomeRegisterTest"));
}
}
@Nested
@DisplayName("FileHandling IncomeRegister to file")
class fileHandlingIncomeRegisterToFile{
String fileTitle = "incomeRegisterTest";
String fileTitle = "/testFiles/economics/incomeRegisterTest";
@Nested
@DisplayName("FileHandling incomeRegister with income that has description")
class fileHandlingIncomeRegisterWithIncomeThatHasDescription{
......@@ -103,7 +103,7 @@ class FileHandlingTest {
@Nested
@DisplayName("FileHandling ExpenseRegister to file")
class fileHandlingExpenseRegisterToFile{
String fileTitle = "expenseRegisterTest";
String fileTitle = "/testFiles/economics/expenseRegisterTest";
@Nested
@DisplayName("FileHandling ExpenseRegister with Expense that has description")
class fileHandlingExpenseRegisterWithExpenseThatHasDescription{
......@@ -170,4 +170,4 @@ class FileHandlingTest {
}
}
}
}
\ No newline at end of file
}
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