diff --git a/project_plan_dev.md b/project_plan_dev.md index 83ba68d..464377c 100644 --- a/project_plan_dev.md +++ b/project_plan_dev.md @@ -1,9 +1,9 @@ -# Project Planning and Development with Github +# Project Planning and Development with GitHub -In this course project, you are expected to use Github to manage your code. This document describes the workflow for using Github when you are developing the course project. Please read it carefully and follow the instructions. **Try to work through the steps with the help of your team first, but please ask for help if your team gets stuck on any of the steps or needs something clarified.** +In this course project, you are expected to use GitHub to manage your code. This document describes the workflow for using GitHub when you are developing the course project. Please read it carefully and follow the instructions. **Try to work through the steps with the help of your team first, but please ask for help if your team gets stuck on any of the steps or needs something clarified.** -## Create a New Github Project -[Github Projects](https://docs.github.com/en/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects) (*Yes, the name of this product is called "Github Projects", do not confuse it with the course project*) is a lightweight project management tool that is integrated to Github. You can use it to track issues, pull requests, visualize tasks status, and track responsibilities. **TAs will mark you project implementation plan and track your progression using the Github project.** +## Create a New GitHub Project +[GitHub Projects](https://docs.github.com/en/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects) (*Yes, the name of this product is called "GitHub Projects", do not confuse it with the course project*) is a lightweight project management tool that is integrated to GitHub. You can use it to track issues, pull requests, visualize tasks status, and track responsibilities. **TAs will mark you project implementation plan and track your progression using the GitHub project.** 1. Navigate to **Projects** Page on [CSC207 organization page](https://github.com/orgs/CSC207-2023Y-UofT/projects) @@ -18,10 +18,10 @@ In this course project, you are expected to use Github to manage your code. This ![](images/link_project.png) -5. The project will show up in the the list below. +5. The project will show up in the list below. ## Define Your Features for the Implementation Plan -As a part of the project planning, you are required to record all features formulated from your user stories, as **issues** in your Github repository. +As a part of the project planning, you are required to record all features formulated from your user stories, as **issues** in your GitHub repository. 1. Navigate to your repository and select **Issues** tab, then click **New issue**. @@ -30,7 +30,7 @@ As a part of the project planning, you are required to record all features formu 1. Fill in the title as the name of the feature and provide a brief description of the feature. **Please use a consistent naming convention for your issues.** For example, you can use the following format: `[Feature x] ` -2. On the side bar, select the **Assignee**, **Labels** (Enhancement for your Features), and **Projects**(the one you just created) for the issue. Then click **Submit new issue**. +2. On the sidebar, select the **Assignee**, **Labels** (Enhancement for your Features), and **Projects**(the one you just created) for the issue. Then click **Submit new issue**. ![](images/set_tags.png) @@ -40,7 +40,7 @@ As a part of the project planning, you are required to record all features formu ## Feature Development When you work on a feature, you are always required to create a **branch** for the feature and **merge** the branch back to the main branch with **pull requests** when the feature is completed. Note: the below should remind you of the "workflow" we covered in the first lab this term. Please review the details of that document in addition to the below, which provides additional details about how the process works on GitHub. -1. To create a new branch, navigate to the issue you are assigned to, and click **Create branch** on the right side bar. +1. To create a new branch, navigate to the issue you are assigned to, and click **Create branch** on the right sidebar. ![](images/create_branch.png) @@ -84,10 +84,10 @@ must be reviewed and approved by other team members before merging.** :warning: 6. (Optional) Delete the feature branch after the pull request is merged. You can delete the branch by navigating to the **View all branches** page. -7. (Optional) If the feature is not completed or you want to continue working on the feature, you can reopen the issue and create new pull requests. Remember to change the status of the issue to **In Progress**. +7. (Optional) If the feature is not completed, or you want to continue working on the feature, you can reopen the issue and create new pull requests. Remember to change the status of the issue to **In Progress**. -## More Project Management and Other Resoruces (Optional) +## More Project Management and Other Resources (Optional) - Use issues to keep track of bugs, tasks and other things that need to be done by selecting the appropriate labels. @@ -95,7 +95,7 @@ must be reviewed and approved by other team members before merging.** :warning: - Use Projects to tracks issues and collaborate with your team. See the [sample project (Password Manager example)](https://github.com/orgs/CSC207-2022F-UofT/projects/2) for reference. -- Github document for projects: https://docs.github.com/en/issues/planning-and-tracking-with-projects +- GitHub document for projects: https://docs.github.com/en/issues/planning-and-tracking-with-projects - Git operations: https://docs.github.com/en/get-started/using-git diff --git a/src/main/java/entities/MonthObject.java b/src/main/java/entities/MonthObject.java index f5f6a1c..988faaa 100644 --- a/src/main/java/entities/MonthObject.java +++ b/src/main/java/entities/MonthObject.java @@ -5,6 +5,7 @@ * they can be created by MonthObjectFactory classes. It contains the setName and getName methods that all MonthObject * classes should have. */ +@SuppressWarnings("unused") // These methods are actually used, but just on the concrete class public interface MonthObject { /** diff --git a/src/main/java/entities/MonthObjectFactoryInputData.java b/src/main/java/entities/MonthObjectFactoryInputData.java index 343f762..21e96aa 100644 --- a/src/main/java/entities/MonthObjectFactoryInputData.java +++ b/src/main/java/entities/MonthObjectFactoryInputData.java @@ -9,6 +9,7 @@ * that each version of addMonthObject and editMonthObject in CategoryFactory and ExpenseFactory can take in a different * set of input data objects that are child classes of MonthObjectFactoryInputData. */ +@SuppressWarnings("unused") // These methods are actually used, but just on the concrete class public abstract class MonthObjectFactoryInputData { /** diff --git a/src/main/java/use_cases/add_edit_category_use_case/CategoryID.java b/src/main/java/use_cases/add_edit_category_use_case/CategoryID.java index 2d59ea7..a333d7f 100644 --- a/src/main/java/use_cases/add_edit_category_use_case/CategoryID.java +++ b/src/main/java/use_cases/add_edit_category_use_case/CategoryID.java @@ -9,7 +9,7 @@ public class CategoryID { private final String name; - private Object value; + private final Object value; private final int monthID; private final SessionStorage session; @@ -33,7 +33,6 @@ public CategoryID(String name, Object value, int monthID, SessionStorage session } public String getName(){return name;} public Object getValue(){return value;} - public void setValue(double value){this.value = value;} public int getMonthID(){return monthID;} public SessionStorage getSession(){return session;} public String getOldCategory(){return oldCategory;} diff --git a/src/main/java/use_cases/add_edit_category_use_case/CategoryUCI.java b/src/main/java/use_cases/add_edit_category_use_case/CategoryUCI.java index 7e89a06..1f66062 100644 --- a/src/main/java/use_cases/add_edit_category_use_case/CategoryUCI.java +++ b/src/main/java/use_cases/add_edit_category_use_case/CategoryUCI.java @@ -52,11 +52,12 @@ private double toDouble(Object value) throws NumberFormatException, NullPointerE * * @param categoryIDAdd CategoryID required for adding a new category to designated monthID MonthlyStorage Object. * @return CategoryOD String message indicating success/fail add attempt. + * @throws EntityException thrown when the new category input is invalid. */ @Override - public CategoryOD addCategoryInMonth(CategoryID categoryIDAdd) { + public CategoryOD addCategoryInMonth(CategoryID categoryIDAdd) throws EntityException { + this.month = categoryIDAdd.getSession().getMonthlyData(categoryIDAdd.getMonthID()); try { - this.month = categoryIDAdd.getSession().getMonthlyData(categoryIDAdd.getMonthID()); double valueDouble = toDouble(categoryIDAdd.getValue()); if (valueDouble < 0) { diff --git a/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseID.java b/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseID.java index 1bd0a33..c38d459 100644 --- a/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseID.java +++ b/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseID.java @@ -7,8 +7,7 @@ */ public class ExpenseID { private final String name; - private Object value; - + private final Object value; private final String category; private final boolean isRecurringExpense; private final int monthID; @@ -48,12 +47,6 @@ public ExpenseID(String name, Object value, String category, boolean isRecurring */ public Object getValue(){return value;} - /** - * Sets Double Expense value. (Casting occurs in ExpenseUCI) - * @param value double passed in from ExpenseUCI to cast user input into a valid Expense attribute. - */ - public void setValue(double value){this.value = value;} - /** * Gets String Category name that this Expense belongs to (before add/edit expense occurs). * @return String Category name associated with the Expense in this use case. diff --git a/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseOD.java b/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseOD.java index e5127fa..5384975 100644 --- a/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseOD.java +++ b/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseOD.java @@ -4,7 +4,7 @@ * ExpenseOD passes a String message (from ExpenseP) resulting from the success or fail add/edit Expense attempt. */ public class ExpenseOD { - String message; + private final String message; /** * Constructs ExpenseOD by passing a String context-specific message generated in ExpenseUCI. diff --git a/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseUCI.java b/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseUCI.java index 02c9d0b..83d4b1e 100644 --- a/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseUCI.java +++ b/src/main/java/use_cases/add_edit_expenses_use_case/ExpenseUCI.java @@ -40,12 +40,13 @@ public static double toDouble(Object value) throws NumberFormatException { * * @param expenseIDAdd ExpenseID required for adding a new expense to the designated monthID MonthlyStorage Object. * @return ExpenseOD String message indicating success/fail add attempt. + * @throws EntityException thrown when the new expense input is invalid. */ @Override - public ExpenseOD addExpenseInMonth(ExpenseID expenseIDAdd) { + public ExpenseOD addExpenseInMonth(ExpenseID expenseIDAdd) throws EntityException { + SessionStorage session = expenseIDAdd.getSession(); + this.month = session.getMonthlyData(expenseIDAdd.getMonthID()); try { - SessionStorage session = expenseIDAdd.getSession(); - this.month = session.getMonthlyData(expenseIDAdd.getMonthID()); double valueDouble = toDouble(expenseIDAdd.getValue()); if (valueDouble < 0) { diff --git a/src/main/java/use_cases/create_new_month/NewMonthUCI.java b/src/main/java/use_cases/create_new_month/NewMonthUCI.java index c0e9958..d917762 100644 --- a/src/main/java/use_cases/create_new_month/NewMonthUCI.java +++ b/src/main/java/use_cases/create_new_month/NewMonthUCI.java @@ -56,7 +56,7 @@ public NewMonthOD createOutput(NewMonthID input) { * @param monthID the monthID of the new MonthlyStorage * @param budgetValue the budget for the new MonthlyStorage * @return new MonthlyStorage object - * @throws EntityException if an error in the program causes two Expenese in recurData to have the same name + * @throws EntityException if an error in the program causes two Expense in recurData to have the same name */ private MonthlyStorage createNewMonth(SessionStorage session, int monthID, double budgetValue) throws EntityException { ArrayList recurData= session.getRecurData(); diff --git a/src/main/java/use_cases/monthly_menu/MonthMenuOD.java b/src/main/java/use_cases/monthly_menu/MonthMenuOD.java index 71eb7b8..f795d1c 100644 --- a/src/main/java/use_cases/monthly_menu/MonthMenuOD.java +++ b/src/main/java/use_cases/monthly_menu/MonthMenuOD.java @@ -17,7 +17,7 @@ public class MonthMenuOD { private ArrayList categoryData; private double monthlyBudget; private String warning; - boolean successful; + private final boolean successful; /** * Constructs an MonthMenuOD holding output data. diff --git a/src/main/java/use_cases/session_load/SessionLoadIB.java b/src/main/java/use_cases/session_load/SessionLoadIB.java index 3e25945..c5e51cf 100644 --- a/src/main/java/use_cases/session_load/SessionLoadIB.java +++ b/src/main/java/use_cases/session_load/SessionLoadIB.java @@ -2,7 +2,7 @@ /** * The input boundary interface for loading sessions - * The SessionLoadUCI interactor class implements this interface and it is called by + * The SessionLoadUCI interactor class implements this interface, and it is called by * the SessionLoadC controller class */ public interface SessionLoadIB { diff --git a/src/main/java/use_cases/session_load/SessionLoadOB.java b/src/main/java/use_cases/session_load/SessionLoadOB.java index 40cfc83..ae93fee 100644 --- a/src/main/java/use_cases/session_load/SessionLoadOB.java +++ b/src/main/java/use_cases/session_load/SessionLoadOB.java @@ -4,7 +4,7 @@ /** * The output boundary interface for displaying the result of loading a session - * The SessionLoadP presenter class implements this interface and it is called by + * The SessionLoadP presenter class implements this interface, and it is called by * the SessionLoadUCI interactor class */ public interface SessionLoadOB { diff --git a/src/main/java/views/add_edit_category_views/AddCategoryV.java b/src/main/java/views/add_edit_category_views/AddCategoryV.java index b583ea4..7e73cb1 100644 --- a/src/main/java/views/add_edit_category_views/AddCategoryV.java +++ b/src/main/java/views/add_edit_category_views/AddCategoryV.java @@ -75,7 +75,7 @@ public void openAddCategory() { } /** - * Checks and formats user input to pass in valid parameters for a CategtoryC to start a use case. + * Checks and formats user input to pass in valid parameters for a CategoryC to start a use case. */ @Override public void actionPerformed(ActionEvent evt) { @@ -115,7 +115,7 @@ private void tryUseCaseAdd() { monthID, currSession, oldCategory); frame.setVisible(false); // Update Month Menu - loadMonthMenu(currSession, monthID, null); + ((LoadMonthMenuVB) this).loadMonthMenu(currSession, monthID, null); } catch (EntityException e) { JOptionPane.showMessageDialog(this, "This month does not exist in current session. Please go to add month page."); diff --git a/src/main/java/views/add_edit_category_views/EditCategoryV.java b/src/main/java/views/add_edit_category_views/EditCategoryV.java index 518f310..7c71c15 100644 --- a/src/main/java/views/add_edit_category_views/EditCategoryV.java +++ b/src/main/java/views/add_edit_category_views/EditCategoryV.java @@ -82,7 +82,7 @@ public void openEditCategory() { } /** - * Checks and formats user input to pass in valid parameters for a CategtoryC to start a use case. + * Checks and formats user input to pass in valid parameters for a CategoryC to start a use case. */ @Override public void actionPerformed(ActionEvent evt) { @@ -128,7 +128,7 @@ private void tryUseCaseEdit() { currSession, selectedCategory); frame.setVisible(false); // Update Month Menu - loadMonthMenu(currSession, monthID, null); + ((LoadMonthMenuVB) this).loadMonthMenu(currSession, monthID, null); } catch (EntityException e) { JOptionPane.showMessageDialog(this, "This month does not exist in current session. " + "Please go to add month page."); diff --git a/src/main/java/views/add_edit_epense_views/AddExpenseV.java b/src/main/java/views/add_edit_epense_views/AddExpenseV.java index d2eb527..b64e0c7 100644 --- a/src/main/java/views/add_edit_epense_views/AddExpenseV.java +++ b/src/main/java/views/add_edit_epense_views/AddExpenseV.java @@ -64,9 +64,9 @@ public void openAddExpense() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(50, 30, 50, 30)); panel.setLayout(new GridLayout(0, 1)); - JPanel panell = new JPanel(); - panell.setBorder(BorderFactory.createEmptyBorder(50, 30, 50, 30)); - panell.setLayout(new GridLayout(0, 1)); + JPanel panel2 = new JPanel(); + panel2.setBorder(BorderFactory.createEmptyBorder(50, 30, 50, 30)); + panel2.setLayout(new GridLayout(0, 1)); frame.add(panel, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); @@ -79,8 +79,8 @@ public void openAddExpense() { panel.add(selectCategoryLabel); panel.add(categoryCombo); panel.add(isRecurringCheckBox); - frame.add(panell, BorderLayout.SOUTH); - panell.add(submit); + frame.add(panel2, BorderLayout.SOUTH); + panel2.add(submit); frame.pack(); frame.setVisible(true); @@ -101,7 +101,7 @@ public void actionPerformed(ActionEvent evt) { try { message = controller.expenseInMonth(nameInput.getText(), valueInput.getText(), selectedCategory, isRecurring, monthID, currSession, selectedExpense); frame.setVisible(false); - loadMonthMenu(currSession, monthID, null); + ((LoadMonthMenuVB) this).loadMonthMenu(currSession, monthID, null); } catch (EntityException e) { JOptionPane.showMessageDialog(this, "This month does not exist in current session. Please go to add month page."); } diff --git a/src/main/java/views/add_edit_epense_views/EditExpenseV.java b/src/main/java/views/add_edit_epense_views/EditExpenseV.java index da557d6..ac6a1a2 100644 --- a/src/main/java/views/add_edit_epense_views/EditExpenseV.java +++ b/src/main/java/views/add_edit_epense_views/EditExpenseV.java @@ -131,7 +131,7 @@ public void actionPerformed(ActionEvent evt) { isRecurring, monthID, currSession, selectedExpense); frame.setVisible(false); // Update Month Menu - loadMonthMenu(currSession, monthID, null); + ((LoadMonthMenuVB) this).loadMonthMenu(currSession, monthID, null); } catch (EntityException e) { JOptionPane.showMessageDialog(this, "This month does not exist in current " + "session. Please go to add month page."); diff --git a/src/main/java/views/create_new_month/NewMonthV.java b/src/main/java/views/create_new_month/NewMonthV.java index 7e580c1..a1ca443 100644 --- a/src/main/java/views/create_new_month/NewMonthV.java +++ b/src/main/java/views/create_new_month/NewMonthV.java @@ -6,10 +6,10 @@ import use_cases.monthly_menu.UpdateViewIB; import use_cases.monthly_menu.UpdateViewUCI; import views.load_monthly_menu.LoadMonthMenuVB; -import views.main_menu.MainMenuV; import views.monthly_menu.MonthMenuP; import views.monthly_menu.MonthMenuV; import views.monthly_menu.UpdateViewC; +import views.session_load.SessionLoadMainMenuVB; import javax.swing.*; import java.awt.*; @@ -23,7 +23,7 @@ * NewMonthOD object, and use the output to set up success and fail view. */ public class NewMonthV implements ActionListener, LoadMonthMenuVB { - private final MainMenuV mainMenu; + private final SessionLoadMainMenuVB mainMenu; private final NewMonthC controller; private final SessionStorage session; private final JFrame frame = new JFrame("Creat a new Month"); @@ -43,7 +43,7 @@ public class NewMonthV implements ActionListener, LoadMonthMenuVB { * @param controller the controller class to get output data * @param session the SessionStorage to store the new MonthlyStorage */ - public NewMonthV (MainMenuV mainMenu, NewMonthC controller, SessionStorage session){ + public NewMonthV (SessionLoadMainMenuVB mainMenu, NewMonthC controller, SessionStorage session){ this.mainMenu = mainMenu; this.controller = controller; this.session = session; @@ -146,7 +146,7 @@ private void getOutput(){ // Update Main Menu dropdown list of Months mainMenu.openMainMenu(null,session); // Load new Month Menu for the new MonthlyStorage - loadMonthMenu(session,monthID,"Month created successfully."); + ((LoadMonthMenuVB) this).loadMonthMenu(session,monthID,"Month created successfully."); } else { JOptionPane.showMessageDialog(frame, output.getWarning()); } diff --git a/src/main/java/views/main_menu/MainMenuV.java b/src/main/java/views/main_menu/MainMenuV.java index f3a36cf..b7e488c 100644 --- a/src/main/java/views/main_menu/MainMenuV.java +++ b/src/main/java/views/main_menu/MainMenuV.java @@ -136,7 +136,7 @@ public void actionPerformed(ActionEvent e) { } } else if (e.getSource() == this.selectMonthButton) { // Open a new MonthMenuV to display the selected month - this.loadMonthMenu(this.session, this.selectedMonthID, null); + ((LoadMonthMenuVB) this).loadMonthMenu(this.session, this.selectedMonthID, null); } else if (e.getSource() == this.createMonthButton) { // Open a new NewMonthV so user can create their new month NewMonthC newMonthController = new NewMonthC(new NewMonthUCI(new NewMonthP())); diff --git a/src/main/java/views/session_load/SessionLoadC.java b/src/main/java/views/session_load/SessionLoadC.java index 501aa6a..1493f74 100644 --- a/src/main/java/views/session_load/SessionLoadC.java +++ b/src/main/java/views/session_load/SessionLoadC.java @@ -7,7 +7,7 @@ /** * The controller class for the session load menu. - * It is called by the view with the user input and it calls the interactor + * It is called by the view with the user input, and it calls the interactor * through the SessionLoadIB interface */ public class SessionLoadC { diff --git a/src/main/java/views/session_load/SessionLoadMenuV.java b/src/main/java/views/session_load/SessionLoadMenuV.java index 819366e..f159737 100644 --- a/src/main/java/views/session_load/SessionLoadMenuV.java +++ b/src/main/java/views/session_load/SessionLoadMenuV.java @@ -3,7 +3,6 @@ import entities.SessionStorage; import use_cases.session_load.SessionLoadException; import use_cases.session_load.SessionLoadOD; -import views.main_menu.MainMenuV; import javax.swing.*; import java.awt.*; @@ -15,12 +14,12 @@ * session, and one for loading an existing session from a file. It reports any errors through a popup * and sends the user to the main menu after successfully loading a file. */ -public class SessionLoadMenuV extends JPanel implements SessionLoadMenuVB, ActionListener { +public class SessionLoadMenuV extends JPanel implements ActionListener { private final SessionLoadC controller; - private final MainMenuV mainMenuV; + private final SessionLoadMainMenuVB mainMenuV; - public SessionLoadMenuV(SessionLoadC controller, MainMenuV mainMenuV) { + public SessionLoadMenuV(SessionLoadC controller, SessionLoadMainMenuVB mainMenuV) { this.controller = controller; this.mainMenuV = mainMenuV; @@ -48,8 +47,7 @@ public SessionLoadMenuV(SessionLoadC controller, MainMenuV mainMenuV) { * * @param message a String containing an error message to display */ - @Override - public void displayError(String message) { + private void displayError(String message) { JOptionPane.showMessageDialog(this, message); } @@ -59,7 +57,7 @@ public void displayError(String message) { * @param message a String containing a success message to display * @param session a SessionStorage object with the loaded session that will be displayed in the main menu */ - public void displaySuccess(String message, SessionStorage session) { + private void displaySuccess(String message, SessionStorage session) { this.setVisible(false); this.mainMenuV.openMainMenu(message, session); } diff --git a/src/main/java/views/session_load/SessionLoadMenuVB.java b/src/main/java/views/session_load/SessionLoadMenuVB.java deleted file mode 100644 index 0ecb78f..0000000 --- a/src/main/java/views/session_load/SessionLoadMenuVB.java +++ /dev/null @@ -1,24 +0,0 @@ -package views.session_load; - -import entities.SessionStorage; - -/** - * A view boundary interface to display a success or error message when loading a session - * The SessionLoadMenuV view class implements this interface - */ -public interface SessionLoadMenuVB { - /** - * Displays an error message in a popup - * - * @param message a String containing an error message to display - */ - void displayError(String message); - - /** - * Closes this menu by setting its visibility to false and opens the main menu - * - * @param message a String containing a success message to display - * @param session a SessionStorage object with the loaded session that will be displayed in the main menu - */ - void displaySuccess(String message, SessionStorage session); -} \ No newline at end of file diff --git a/src/test/java/use_cases/main_menu/SessionSaveUCITest.java b/src/test/java/use_cases/main_menu/SessionSaveUCITest.java index 399114a..f33d2c0 100644 --- a/src/test/java/use_cases/main_menu/SessionSaveUCITest.java +++ b/src/test/java/use_cases/main_menu/SessionSaveUCITest.java @@ -51,7 +51,8 @@ void SessionSaveUCISave() throws IOException, ClassNotFoundException { Assertions.assertEquals(loadedSession, sampleSession); // Cleanup - new File("UCISaveFileTest.ser").delete(); + boolean deletedTestFile = new File("UCISaveFileTest.ser").delete(); + Assertions.assertTrue(deletedTestFile); } /** diff --git a/src/test/java/use_cases/session_load/SessionLoadUCITest.java b/src/test/java/use_cases/session_load/SessionLoadUCITest.java index ea941e9..a89ebab 100644 --- a/src/test/java/use_cases/session_load/SessionLoadUCITest.java +++ b/src/test/java/use_cases/session_load/SessionLoadUCITest.java @@ -80,7 +80,8 @@ public void SessionLoadUCILoadFile() throws IOException { Assertions.assertEquals(session, sampleSession); // Cleanup - new File("UCILoadFileTest.ser").delete(); + boolean deletedTestFile = new File("UCILoadFileTest.ser").delete(); + Assertions.assertTrue(deletedTestFile); } /** @@ -121,7 +122,8 @@ public void SessionLoadUCILoadInvalidFile() throws IOException { ); // Build an invalid file to load - new File("Hello world.txt").createNewFile(); + boolean createdTestFile = new File("Hello world.txt").createNewFile(); + Assertions.assertTrue(createdTestFile); // Test loading invalid file SessionLoadID inputData = new SessionLoadID("Hello world.txt"); @@ -131,6 +133,7 @@ public void SessionLoadUCILoadInvalidFile() throws IOException { Assertions.assertEquals(session, sampleSession); // Cleanup - new File("Hello world.txt").delete(); + boolean deletedTestFile = new File("Hello world.txt").delete(); + Assertions.assertTrue(deletedTestFile); } } diff --git a/src/test/java/views/file_session_storage/FileSessionStorageTest.java b/src/test/java/views/file_session_storage/FileSessionStorageTest.java index 348bc33..82e42f4 100644 --- a/src/test/java/views/file_session_storage/FileSessionStorageTest.java +++ b/src/test/java/views/file_session_storage/FileSessionStorageTest.java @@ -55,7 +55,8 @@ public void FileSessionStorage() throws IOException, ClassNotFoundException { Assertions.assertEquals(sampleSession, savedAndLoadedSession); // Cleanup - new File("FSSSaveFileTest.ser").delete(); + boolean deletedTestFile = new File("FSSSaveFileTest.ser").delete(); + Assertions.assertTrue(deletedTestFile); } /** @@ -78,12 +79,14 @@ public void FileSessionStorageLoadInvalidFile() throws IOException { FileSessionStorage fileSessionStorage = new FileSessionStorage(); // Build an invalid file to load - new File("Hello world.txt").createNewFile(); + boolean createdTestFile = new File("Hello world.txt").createNewFile(); + Assertions.assertTrue(createdTestFile); Assertions.assertThrows(IOException.class, () -> fileSessionStorage.load("Hello world.txt")); // Cleanup - new File("Hello world.txt").delete(); + boolean deletedTestFile = new File("Hello world.txt").delete(); + Assertions.assertTrue(deletedTestFile); } /**