diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 613dddac75..79b0bcf3fb 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -31,7 +31,7 @@ The main logic of the application is handled by these four components - Responsible for retrieving data from the **Data Repository** - does not depend on any of the other three components (as the Model represents data entities of the domain, they should make sense on their own without depending on other components) - +![ModelComponent.png](diagrams%2FModelComponent.png) - **Storage**: - can save both schedule data and user data in .txt format, and read them back into corresponding objects. @@ -209,32 +209,45 @@ Sem 8: Happy degree planning! ``` -## List Modules Left Feature +## List Required Modules Left Feature The following sequence diagram shows how the Left Command function works. ![LeftFeature_Seq.png](diagrams%2FLeftFeature_Seq.png) -The left mechanism is implemented to help users keep tracks of modules left for their major. It is facilitated by `modulesLeft`, `modulesMajor` and `modulesTaken`. Additionally, it implements the following operations: - -- `student#getModulesMajor()` and `student#getModulesTaken()` – Returns moduleList modulesMajor and modulesTaken respectively. -- `modulesMajor#showModulesDiff(modulesTaken)` – Display modules left. -- `modulesTaken#getMainModuleList()` - Returns ArrayList of modulesTaken which is the ArrayList of modules taken. -- `new ModuleList()` - Instantiate modulesLeft. +When the user's command is determined to be `left`, the program implements the following operations: +### Function List -This operation is exposed in the `ModulePlannerController` interface as `ModulePlannerController#listModulesLeft()`. +- `new ArrayList()`: Instantiate moduleCodesLeft +- `student#getModuleCodesLeft()`: Returns the ArrayLis +- `schedule#getModulesPlanned()`: Returns modulesPlanned (Module List) +- `modulesPlanned#getCompletedModuleCodes()`: Returns completedModuleCodes (ArrayList ) +- `completedModuleCodes#contains(moduleCode)`: Returns true if completedModuleCodes contain moduleCode +- `moduleCodesLeft#add(moduleCode)`: Add moduleCode to moduleCodesLeft +- `ModuleMethodsController#showModulesLeft(moduleCodesLeft)`: Calls methods `displayMessage("Modules Left:")` and +`printModuleStringArray(moduleCodesLeft)` to display the modules left to the user + ### Usage Examples -Here are a few examples of how the List Modules Left Feature behaves: +Here are a few examples of how the List Required Modules Left Feature behaves: #### Example 1: -`modulesMajor#getMainModuleList()` gives modules `CS1231S CS2030S CS2040S CS2100 CS2101 CS2106 CS2109S CS3230`. -`modulesTaken#getMainModuleList()` gives modules `CS1231S MA1511` +- Major is CEG +- Modules CG1111A, MA1511, MA1512, CS1010, GESS1000, CFG1002 are added to schedule planner and completed Command: `left` Response: -`CS2030S CS2040S CS2100 CS2101 CS2106 CS2109S CS3230` + +``` +Required Modules Left: +1. GEC1000 2. GEN2000 3. ES2631 4. GEA1000 5. DTK1234 +6. EG1311 7. IE2141 8. EE2211 9. EG2501 10. CDE2000 +11. PF1101 12. CG4002 13. MA1508E 14. EG2401A 15. CP3880 +16. CG2111A 17. CS1231 18. CG2023 19. CG2027 20. CG2028 +21. CG2271 22. ST2334 23. CS2040C 24. CS2113 25. EE2026 +26. EE4204 +``` ## Add Module Feature diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 588d8dd758..df7d3844f4 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -23,7 +23,7 @@ It's a comprehensive tool for efficient and successful degree completion. 1. Ensure that you have Java 11 or above installed. 2. Download the latest version of `NUSDegs` from [here](https://github.com/AY2324S1-CS2113-T17-4/tp/releases/tag/vbeta) ( (Real one to be updated for PE) -3. Downlaod the NUSDegs.jar to the folder you want to use as the home folder for NUSDegs. +3. Download the NUSDegs.jar to the folder you want to use as the home folder for NUSDegs. 4. Open a command terminal, cd into the folder you put the .jar file in, and run the command java -jar "NUSDegs.jar" to run the application. @@ -54,7 +54,7 @@ to be corrupted and therefore lost! - [Shift module in schedule planner: `shift`](#shift-module-in-schedule-planner-shift) - [Clear all schedule planner and completion data: `clear`](#clear-all-schedule-planner-and-completion-data-clear) - [Complete a module in your schedule planner: `complete`](#complete-a-module-complete) -- [View modules left for graduation: `left`](#checking-modules-left-left) +- [View modules left for graduation: `left`](#list-required-modules-left-left) - [Check current pace to graduate: `pace`](#check-current-pace-to-graduate-pace) - [View weekly timetable: `timetable show`](#view-weekly-timetable-timetable-show) - [Modify weekly timetable: `timetable modify`](#modify-weekly-timetable-timetable-modify) @@ -111,6 +111,66 @@ User input: - Expected outcome: +``` +#==========================================================# +║ Modular Requirements for CEG Units ║ +#==========================================================# ++----------------------------------------------------------+ +│ Common Curriculum Requirements 60 │ ++----------------------------------------------------------+ + GES1000 (Singapore Studies) 4 + GEC1000 (Cultures and Connections) 4 + GEN2000 (Communities and Engagement) 4 + ES2631 Critique & Communication of Thinking + & Design (Critique & Expression) 4 + CS1010 Programming Methodology (Digital + Literacy) 4 + GEA1000 Quantitative Reasoning with Data (Data + Literacy) 4 + DTK1234 Design Thinking (Design Thinking) 4 + EG1311 Design and Make (Maker Space) 4 + IE2141 Systems Thinking and Dynamics (Systems + Thinking) 4 + EE2211 Introduction to Machine Learning + (Artificial Intelligence) 4 + CDE2501 Liveable Cities (Sustainable Futures) 4 + CDE2000 (Creating Narratives) 4 + PF1101 Fundamentals of Project Management + (Project Management) 4 + CG4002 Computer Engineering Capstone Project 1 + (Integrated Project) 8 + ++----------------------------------------------------------+ +│ Programme Requirements 60 │ ++----------------------------------------------------------+ + ~~ Engineering Core 20 ~~ + + MA1511 Engineering Calculus 2 + MA1512 Differential Equations for Engineering 2 + MA1508E Linear Algebra for Engineering 4 + EG2401A Engineering Professionalism 2 + CP3880 Advanced Technology Attachment Programme 12 + + ~~ CEG Major 40 ~~ + + CG1111A Engineering Principles and Practice I 4 + CG2111A Engineering Principles and Practice II 4 + CS1231 Discrete Structures 4 + CG2023 Signals & Systems 4 + CG2027 Transistor-level Digital Circuit 2 + CG2028 Computer Organization 2 + CG2271 Real-time Operating System 4 + CS2040C Data Structures and Algorithms 4 + CS2113 Software Engineering & Object-Oriented + Programming 4 + EE2026 Digital Design 4 + EE4204 Computer Networks 4 + ++----------------------------------------------------------+ +│ Unrestricted Electives 40 │ ++----------------------------------------------------------+ +``` + Image Image @@ -122,8 +182,63 @@ User input: - Expected outcome: -Image -Image +``` +#==========================================================# +║ Modular Requirements for CS Units ║ +#==========================================================# ++----------------------------------------------------------+ +│ Common Curriculum Requirements 40 │ ++----------------------------------------------------------+ + ~~ University Requirements: 6 University Pillars 24 ~~ + + CS1101S Programming Methodology (Digital + Literacy) 4 + ES2660 Communicating in the Information Age + (Critique and Expression) 4 + GEC1% (Cultures and Connections) 4 + GEA1000 / BT1101 / ST1131 / DSA1101 (Data + Literacy) 4 + GES1% (Singapore Studies) 4 + GEN2% (Communities and Engagement) 4 + + ~~ Computing Ethics 4 ~~ + + IS1108 Digital Ethics and Data Privacy 4 + + ~~ Inter & Cross-Disciplinary Education 12 ~~ + + Interdisciplinary (ID) Courses (at least 2) + Cross-disciplinary (CD) Courses (no more than 1) + ++----------------------------------------------------------+ +│ Programme Requirements 80 │ ++----------------------------------------------------------+ + ~~ Computer Science Foundation 36 ~~ + + CS1231S Discrete Structures 4 + CS2030S Programming Methodology II 4 + CS2040S Data Structures and Algorithms 4 + CS2100 Computer Organisation 4 + CS2101 Effective Communication for Computing + Professionals 4 + CS2103T Software Engineering 4 + CS2106 Introduction to Operating Systems 4 + CS2109S Introduction to AI and Machine Learning 4 + CS3230 Design and Analysis of Algorithms 4 + + ~~ Computer Science Breadth and Depth 32 ~~ + + + ~~ Mathematics and Sciences 12 ~~ + + MA1521 Calculus for Computing 4 + MA1522 Linear Algebra for Computing 4 + ST2334 Probability and Statistics 4 + ++----------------------------------------------------------+ +│ Unrestricted Electives 40 │ ++----------------------------------------------------------+ +``` ### View module prerequisites:`prereq` @@ -374,10 +489,10 @@ Expected outcome: -### Checking modules left: `left` -Displays the modules left, which is the remainder of subtracting modules completed (modules added to schedule planner -and marked as completed), from the modules required for the user's major (modules displayed for `required` command) -that have not been completed +### List required modules left: `left` +Displays the required modules left, which is the remainder after subtracting the modules completed +(modules added to schedule planner and marked as completed), from the modules required for the user's major +(modules displayed for `required` command) that have not been completed ##### Format: `left` @@ -387,18 +502,32 @@ User input: `left` - Expected outcome: +``` +Required Modules Left: +1. CG1111A 2. MA1511 3. MA1512 4. CS1010 5. GESS1000 +6. GEC1000 7. GEN2000 8. ES2631 9. GEA1000 10. DTK1234 +11. EG1311 12. IE2141 13. EE2211 14. EG2501 15. CDE2000 +16. PF1101 17. CG4002 18. MA1508E 19. EG2401A 20. CP3880 +21. CG2111A 22. CS1231 23. CG2023 24. CG2027 25. CG2028 +26. CG2271 27. ST2334 28. CS2040C 29. CS2113 30. EE2026 +31. EE4204 +``` -- ![ss_left_ceg.png](screenshots%2Fss_left_ceg.png) - - -##### Example of usage 2: (major is CEG, CS1010 & GEC1000 are added and completed) +##### Example of usage 2: (major is CEG, CG1111A & CS1010 & GEC1000 are added and completed) User input: `left` - Expected outcome: - -![ss_left_ceg_completed.png](screenshots%2Fss_left_ceg_completed.png) +``` +Required Modules Left: +1. MA1511 2. MA1512 3. GEC1000 4. GEN2000 5. ES2631 +6. GEA1000 7. DTK1234 8. EG1311 9. IE2141 10. EE2211 +11. EG2501 12. CDE2000 13. PF1101 14. CG4002 15. MA1508E +16. EG2401A 17. CP3880 18. CG2111A 19. CS1231 20. CG2023 +21. CG2027 22. CG2028 23. CG2271 24. ST2334 25. CS2040C +26. CS2113 27. EE2026 28. EE4204 +``` ### Check current pace to graduate: `pace` @@ -434,14 +563,28 @@ Format: `timetable show` ##### Example of usage: -Scenario 1: No lectures, tutorials or labs exist +Scenario 1: No current semester modules (semester 4) User input: `timetable show` Expected outcome: +``` +Timetable view is unavailable as your current semester has no modules yet. +Add modules using this format: add [module code] 4 +Alternatively, get the recommended schedule for your major: recommend +``` + +Scenario 2: No lectures, tutorials or labs exist (have current semester modules) -![ss_timetableShow_noLessons.png](screenshots%2Fss_timetableShow_noLessons.png) +User input: +`timetable show` + +Expected outcome: +``` +Timetable view is unavailable as modules in your current semester have no lessons yet. +Enter Timetable Modify Mode to add lessons: timetable modify +``` Scenario 2: The lessons have been specified in Timetable Modify Mode - CS2101 has a lecture at 5 for 2 hours on Monday @@ -453,8 +596,17 @@ User input: `timetable show` Expected outcome: - -![ss_timetableShow_lessons.png](screenshots%2Fss_timetableShow_lessons.png) +``` +------------------------------------------------------------ +| DAY | TIMETABLE | +------------------------------------------------------------ +| Monday | CS2101 Lecture (5am-7am) | +------------------------------------------------------------ +| Tuesday | GESS1000 Lecture (11am-2pm) | +------------------------------------------------------------ +| Wednesday | GESS1000 Tutorial (7pm) | +------------------------------------------------------------ +``` ### Modify Weekly Timetable: `timetable modify` @@ -493,15 +645,40 @@ User input: - `GESS1000 LECTURE 12 3 TUESDAY` - `GESS1000 TUTORIAL 19 WEDNESDAY` -![ss_timetableModify_lessons.png](screenshots%2Fss_timetableModify_lessons.png) +Expected outcome: +``` +------------------------------------------------------------ +| DAY | TIMETABLE | +------------------------------------------------------------ +| Monday | CS2101 Lecture (5am-7am) | +------------------------------------------------------------ +| Tuesday | GESS1000 Lecture (11am-2pm) | +------------------------------------------------------------ +| Wednesday | GESS1000 Tutorial (7pm) | +------------------------------------------------------------ +``` +User input: - `GESS1000 clear` -![ss_timetableModify_clear.png](screenshots%2Fss_timetableModify_clear.png) +Expected outcome: +``` +All lessons for selected module are cleared. +------------------------------------------------------------ +| DAY | TIMETABLE | +------------------------------------------------------------ +| Monday | CS2101 Lecture (5am-7am) | +------------------------------------------------------------ +``` +User input: - `exit` -![ss_timetableModify_exit.png](screenshots%2Fss_timetableModify_exit.png) +Expected Outcome: + +``` +Exited Timetable Modify Mode +``` ### Save schedule and timetable and exit the program: `Bye` @@ -516,8 +693,10 @@ their schedule planner and their current semester timetable. User input: `bye` - Expected outcome - -![ss_bye.png](screenshots%2Fss_bye.png) +``` +Data successfully saved in save files +Goodbye! +``` ## FAQ diff --git a/docs/diagrams/LeftFeature.puml b/docs/diagrams/LeftFeature.puml index 09dfe23211..33e4786b24 100644 --- a/docs/diagrams/LeftFeature.puml +++ b/docs/diagrams/LeftFeature.puml @@ -2,15 +2,16 @@ 'https://plantuml.com/sequence-diagram 'autonumber -autoactivate on +'autoactivate on actor Student participant ":Ui" as UI -participant ":Module\nInfoView" as MIV +participant "<> \n:Module\nInfoView" as MIV Student -> UI: getUser\nCommand() \n"left" +activate UI note bottom This command returns the @@ -21,17 +22,20 @@ end note participant "controller:\nMain\nController" as MC #white UI -> MC: handleUser\nInputTillExit\nCommand() +activate MC participant "currentUser\nCommand:\nUserCommand" as UC #white -participant ":ModuleMethods\nController" as MMC +participant "<> \n:ModuleMethods\nController" as MMC MC -> UC **: create activate UC UC --> MC: currentUser\nCommand "left" +deactivate UC MC -> UC: processCommand() +activate UC box "Model" #LightBlue participant "student:\nStudent" as S #white @@ -42,53 +46,60 @@ participant "completed\nModuleCodes:\nArrayList" as CMC #white end box - UC -> S: getModuleCodesLeft() +activate S 'create moduleCodesLeft S -> MCL **: create activate MCL MCL --> S - +deactivate MCL 'schedule.getModulesPlanned().getCompletedModuleCodes() S -> SCH: getModulesPlanned() +activate SCH SCH --> S: modulesPlanned:ModuleList +deactivate SCH -S -> MP: modulesPlanned\n.getCompletedModuleCodes() -MP --> S: completedModuleCodes:\nArrayList - +S -> MP: modulesPlanned.getCompletedModuleCodes() +activate MP +MP --> S: completedModuleCodes:ArrayList +deactivate MP loop moduleCode - S -> CMC: completedModuleCodes\n.contains(moduleCode) + S -> CMC: completedModuleCodes.contains(moduleCode) + activate CMC CMC --> S: contains:Boolean + deactivate CMC opt !contains 'moduleCodesLeft.add(moduleCode) S -> MCL: moduleCodesLeft\n.add(moduleCode) + activate MCL MCL --> S + deactivate MCL end end destroy MCL -S --> UC: "moduleCodesLeft:ArrayList" +S --> UC: moduleCodesLeft\n:ArrayList -UC -> MMC: showModulesLeft\n(ArrayList \nmoduleCodesLeft) +UC -> MMC: showModulesLeft\n(moduleCodesLeft) -MMC -> UI: displayMessage("Modules Left: ") +MMC -> UI: displayMessage() UI --> Student UI --> MMC -MMC -> MIV: printModuleStringArray\n(moduleCodesLeft) +MMC -> MIV: printModuleStringArray(moduleCodesLeft) activate MIV MIV --> Student MIV --> MMC diff --git a/docs/diagrams/LeftFeature_Seq.png b/docs/diagrams/LeftFeature_Seq.png index b12d70954c..1f6916f55b 100644 Binary files a/docs/diagrams/LeftFeature_Seq.png and b/docs/diagrams/LeftFeature_Seq.png differ diff --git a/docs/diagrams/ModelComponent.png b/docs/diagrams/ModelComponent.png new file mode 100644 index 0000000000..a42e40c625 Binary files /dev/null and b/docs/diagrams/ModelComponent.png differ diff --git a/docs/diagrams/Timetable_Class.puml b/docs/diagrams/Timetable_Class.puml new file mode 100644 index 0000000000..0c14c114c7 --- /dev/null +++ b/docs/diagrams/Timetable_Class.puml @@ -0,0 +1,43 @@ +@startuml +'https://plantuml.com/class-diagram + +skinparam classAttributeIconSize 0 + +class Student { +-String year +-ModuleList currentSemesterModules + ++getSchedule() ++setFirstMajor(String userInput) ++timetableShowOrModify(String argument) ++updateTimetable() +-setCurrentSemesterModules() +-setCurrentSemesterModulesWeekly() +} + +Student --> "1" Schedule + +class Schedule { +int[] modulesPerSem; +ModuleList modulesPlanned; +} + +Schedule --> "modulesPlanned" ModuleList + +class ModuleList { +ArrayList +} + +Student --> "1" Timetable + +class Timetable { +ArrayList currentSemesterModulesWeekly +} + + +class ModuleServiceController { + +} + + +@enduml \ No newline at end of file diff --git a/docs/team/janelleenqi.md b/docs/team/janelleenqi.md index a5becf98fe..91052a3272 100644 --- a/docs/team/janelleenqi.md +++ b/docs/team/janelleenqi.md @@ -97,4 +97,14 @@ Added implementation details of the features left, required, timetable show. #### 4. Fixed Bugs -- `Bye`: was case sensitive, needed to input twice to exit +- `Bye`: was case sensitive, needed to input twice to exit [#154](https://github.com/AY2324S1-CS2113-T17-4/tp/pull/154) +- `timetable modify`: fix error messages (had cases with double errors, or no errors) +- infinite loop of error messages [#139](https://github.com/AY2324S1-CS2113-T17-4/tp/pull/139) +- `complete`: complete a completed module [#115](https://github.com/AY2324S1-CS2113-T17-4/tp/issues/115) + +#### 5. Testing +SUT tests for the features Left, Required, Timetable Modify & Timetable Show, the class ModuleList + +##### 6. Community +- PRs reviewed: [#38](https://github.com/AY2324S1-CS2113-T17-4/tp/pull/38#pullrequestreview-1721555155), [#152](https://github.com/AY2324S1-CS2113-T17-4/tp/pull/152), [#155](https://github.com/AY2324S1-CS2113-T17-4/tp/pull/155#pullrequestreview-1721581031), [#157](https://github.com/AY2324S1-CS2113-T17-4/tp/pull/157#pullrequestreview-1719360399) +- Made `timetable modify` less bug prone diff --git a/src/main/java/seedu/duke/models/schema/Student.java b/src/main/java/seedu/duke/models/schema/Student.java index 2c0270b48d..04929a8c51 100644 --- a/src/main/java/seedu/duke/models/schema/Student.java +++ b/src/main/java/seedu/duke/models/schema/Student.java @@ -322,7 +322,7 @@ public void printSchedule() { * * @author @rohitcube */ - public void setCurrentSemesterModules() { + private void setCurrentSemesterModules() { try { int currSem = getCurrentSem(); @@ -357,7 +357,7 @@ public int getCurrentSem() { * * @author @rohitcube */ - public void setCurrentSemesterModulesWeekly() throws TimetableUnavailableException { + private void setCurrentSemesterModulesWeekly() throws TimetableUnavailableException { if (currentSemesterModules == null || currentSemesterModules.getMainModuleList().isEmpty()) { timetable.removeAll(); int currentSem = getCurrentSem(); diff --git a/src/test/java/seedu/duke/controllers/TimetableFeature.java b/src/test/java/seedu/duke/controllers/TimetableFeature.java deleted file mode 100644 index a57a3004fd..0000000000 --- a/src/test/java/seedu/duke/controllers/TimetableFeature.java +++ /dev/null @@ -1,93 +0,0 @@ -package seedu.duke.controllers; - -//import org.junit.jupiter.api.AfterEach; -//import org.junit.jupiter.api.BeforeEach; -//import org.junit.jupiter.api.Test; -//import org.junit.jupiter.api.Test; -//import seedu.duke.models.schema.Student; -//import seedu.duke.models.schema.TimetableUserCommand; -//import seedu.duke.models.schema.UserCommand; -//import seedu.duke.utils.exceptions.InvalidTimetableUserCommandException; - -//import java.io.ByteArrayInputStream; -//import java.io.ByteArrayOutputStream; -//import java.io.InputStream; -//import java.io.PrintStream; -//import java.util.Arrays; - -//import static org.junit.jupiter.api.Assertions.assertEquals; -//import java.util.Scanner; - -//import static org.junit.jupiter.api.Assertions.assertEquals; -//import static seedu.duke.controllers.ModuleMethodsController.completeModule; - -public class TimetableFeature { - - /* - @Test - void testTimetableFeature_addDuplicateLessons_expectNoDuplicates() { - - String[] timetableSetUpUserInputs = {"add cs1010 3", "add cs1231 3"}; - int currentIndex = 0; - currentUserCommand = new UserCommand(timetableSetUpUserInputs[currentIndex]); - while (currentUserCommand.isValid() && !currentUserCommand.isBye()) { - currentUserCommand.processCommand(student); - - currentIndex ++; - currentUserCommand = new UserCommand(timetableSetUpUserInputs[currentIndex]); - } - - currentIndex = 0; - String[] timetableUserInput = {"timetable modify", "cs1010", "lecture /time 12 /duration 2 /day wednesday", - "timetable modify", "cs1010", "lecture /time 12 /duration 2 /day wednesday", "add"}; - currentUserCommand = new UserCommand(timetableUserInput[currentIndex]); - while (currentUserCommand.isValid() && !currentUserCommand.isBye()) { - currentUserCommand.processCommand(student); - - currentIndex ++; - //System.setIn(new InputStream(inputStream)); - //give input - currentIndex ++; - //give input - currentIndex ++; - - //System.setIn(originalIn); - currentUserCommand = new UserCommand(timetableSetUpUserInputs[currentIndex]); - } - - // Capture the printed output - String printedOutput = outputStream.toString().trim(); - printedOutput = printedOutput - .replaceAll("\r\n", "\n") - .replaceAll("\r", "\n"); - - // To exclude printedOutput from add features - String firstPrintedOutput = ""; - int indexTimetableFirstModifyOutput = printedOutput.indexOf("Modules Left: "); - if (indexTimetableFirstModifyOutput != -1) { - // Extract the text starting from the found index - firstPrintedOutput = firstPrintedOutput.substring(indexTimetableFirstModifyOutput); - } - - // To separate the 2 timetable modify output - String secondPrintedOutput = ""; - int indexTimetableSecondModifyOutput = firstPrintedOutput.indexOf("Modules Left: ", 1); - if (indexTimetableSecondModifyOutput != -1) { - // Extract the text starting from the found index - firstPrintedOutput = firstPrintedOutput.substring(0, indexTimetableSecondModifyOutput); - secondPrintedOutput = secondPrintedOutput.substring(indexTimetableSecondModifyOutput); - } - - // Remove last error message - int indexTimetableIrrelevantOutput = secondPrintedOutput.indexOf("Invalid"); - if (indexTimetableIrrelevantOutput != -1) { - // Extract the text starting from the found index - secondPrintedOutput = secondPrintedOutput.substring(0, indexTimetableIrrelevantOutput); - } - - assertEquals(firstPrintedOutput, secondPrintedOutput); - } - - - */ -} diff --git a/src/test/java/seedu/duke/models/schema/TimetableTest.java b/src/test/java/seedu/duke/models/schema/TimetableTest.java deleted file mode 100644 index 0e44be755b..0000000000 --- a/src/test/java/seedu/duke/models/schema/TimetableTest.java +++ /dev/null @@ -1,83 +0,0 @@ -package seedu.duke.models.schema; - -// need to change this when planner class is created - -//import seedu.duke.exceptions.InvalidModifyArgumentException; -//import org.junit.jupiter.api.Test; -//import java.io.ByteArrayOutputStream; -//import java.io.PrintStream; -////import java.util.ArrayList; -// -// -////import static org.junit.Assert.assertTrue; -//import static org.junit.Assert.fail; -//import static org.junit.Assert.assertEquals; -//import static org.junit.jupiter.api.Assertions.assertThrows; -//import static seedu.duke.models.schema.Timetable.timetable; - -public class TimetableTest { - - /* - @Test - void testProcessModifyArgumentsValidInputExpectedTrue() { - String userInput = "lecture /time 10 /duration 1 /day Monday"; - Student student = new Student(); - int indexOfModule = 0; - - .currentSemesterModulesWeekly = new ArrayList(); - timetable.currentSemesterModulesWeekly.add(new ModuleWeekly("CS1010")); - if (timetable.currentSemesterModulesWeekly.isEmpty()) { - System.out.println("why empty"); - } - ModuleWeekly test = new ModuleWeekly("CS1010"); - test.addLecture("Monday", 10, 1); - try { - timetable.processModifyArguments(userInput, indexOfModule, student); - assertTrue(timetable.currentSemesterModulesWeekly.get(0).equals(test)); - } catch (InvalidModifyArgumentException e) { - fail("Unexpected InvalidModifyArgumentException"); - } - } - */ -// @Test -// void testProcessModifyArgumentsInvalidCommand() { -// Student student = new Student(); -// int indexOfModule = 0; -// String userInput = "invalidCommand /time 12 /duration 3 /day Tuesday"; -// -// ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); -// PrintStream originalOut = System.out; -// System.setOut(new PrintStream(outputStream)); -// -// try { -// timetable.processModifyArguments(userInput, indexOfModule, student); -// assertEquals("Not a valid command. Please try again!", outputStream.toString().trim()); -// } catch (InvalidModifyArgumentException e) { -// fail("Unexpected InvalidModifyArgumentException"); -// } finally { -// System.setOut(originalOut); -// } -// } -// -// @Test -// void testProcessModifyArgumentsInvalidArguments() { -// Student student = new Student(); -// int indexOfModule = 0; -// String userInput = "lecture /time 12 /day Tuesday"; -// -// ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); -// PrintStream originalOut = System.out; -// System.setOut(new PrintStream(outputStream)); -// -// try { -// assertThrows(InvalidModifyArgumentException.class, () -> { -// timetable.processModifyArguments(userInput, indexOfModule, student); -// }); -// } finally { -// System.setOut(originalOut); -// } -// } - - //more unit tests to be added - -} diff --git a/src/test/java/seedu/duke/models/schema/TimetableUserCommandTest.java b/src/test/java/seedu/duke/models/schema/TimetableUserCommandTest.java index 452c5bf576..f350a2ead6 100644 --- a/src/test/java/seedu/duke/models/schema/TimetableUserCommandTest.java +++ b/src/test/java/seedu/duke/models/schema/TimetableUserCommandTest.java @@ -47,8 +47,7 @@ void partialTestTimetableModify_perfectInputs_expectTimetable() throws InvalidTi } System.setOut(new PrintStream(outputStream)); - student.setCurrentSemesterModules(); - student.setCurrentSemesterModulesWeekly(); + student.updateTimetable(); TimetableUserCommand currentTimetableCommand = new TimetableUserCommand(student, student.getTimetable().getCurrentSemesterModulesWeekly(), "cs1010 lecture 9 2 Monday"); @@ -89,8 +88,7 @@ void partialTestTimetableModify_perfectInput_expectTimetableErrorMessage() throw } System.setOut(new PrintStream(outputStream)); - student.setCurrentSemesterModules(); - student.setCurrentSemesterModulesWeekly(); + student.updateTimetable(); assertThrows(InvalidTimetableUserCommandException.class, () -> badInput("cs1010 lecture 9 2 Mon")); @@ -107,8 +105,7 @@ void partialTestTimetableModify_badLessonInput_expectTimetableErrorMessage() thr } System.setOut(new PrintStream(outputStream)); - student.setCurrentSemesterModules(); - student.setCurrentSemesterModulesWeekly(); + student.updateTimetable(); assertThrows(InvalidTimetableUserCommandException.class, () -> badInput("cs1010 lect 9 2 Monday"));