forked from nus-cs2113-AY2324S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from SebasFok/SebasFok-FixMajor
Fix major bugs
- Loading branch information
Showing
4 changed files
with
62 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package seedu.duke.models; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class StudentTest { | ||
//success scenario: valid major -> major updated | ||
@Test | ||
void updateMajorTest_validMajor_expectNewMajorMessage() { | ||
Student student = new Student(); | ||
String userInput = "major cs"; | ||
String printedOutputCommand = student.updateMajor(userInput); | ||
assertEquals("newMajor", printedOutputCommand); | ||
} | ||
|
||
//success scenario: no major -> return current major | ||
@Test | ||
void updateMajorTest_noMajor_expectCurrentMajorMessage() { | ||
Student student = new Student(); | ||
String userInput = "major"; | ||
String printedOutputCommand = student.updateMajor(userInput); | ||
assertEquals("currentMajor", printedOutputCommand); | ||
} | ||
|
||
//failure scenario invalid major -> throw exception | ||
@Test | ||
void updateMajorTest_invalidMajor_expectFailureMessage() { | ||
Student student = new Student(); | ||
String userInput = "major abc"; | ||
String printedOutputCommand = student.updateMajor(userInput); | ||
assertEquals("invalidMajor", printedOutputCommand); | ||
} | ||
} |