forked from nus-cs2103-AY2425S1/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.
Tag categories must be saved properly in json
- Loading branch information
Showing
7 changed files
with
136 additions
and
18 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
33 changes: 33 additions & 0 deletions
33
src/test/java/seedu/address/model/tag/TagCategoryTest.java
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,33 @@ | ||
package seedu.address.model.tag; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static seedu.address.testutil.Assert.assertThrows; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.commons.exceptions.IllegalValueException; | ||
|
||
public class TagCategoryTest { | ||
|
||
@Test | ||
public void fromString_validCategories_returnsSuccess() throws IllegalValueException { | ||
// all valid inputs | ||
assertEquals(TagCategory.GENERAL, TagCategory.fromString("GENERAL")); | ||
assertEquals(TagCategory.ACADEMICS, TagCategory.fromString("ACADEMICS")); | ||
assertEquals(TagCategory.NETWORKING, TagCategory.fromString("NETWORKING")); | ||
assertEquals(TagCategory.MENTORSHIP, TagCategory.fromString("MENTORSHIP")); | ||
assertEquals(TagCategory.ACTIVITIES, TagCategory.fromString("ACTIVITIES")); | ||
} | ||
|
||
@Test | ||
public void fromString_invalidCategories_throwsIllegalValueException() { | ||
// completely invalid inputs | ||
assertThrows(IllegalValueException.class, () -> TagCategory.fromString("HEHE")); | ||
assertThrows(IllegalValueException.class, () -> TagCategory.fromString("ACACACACAC")); | ||
|
||
// wrong case | ||
assertThrows(IllegalValueException.class, () -> TagCategory.fromString("Academics")); | ||
assertThrows(IllegalValueException.class, () -> TagCategory.fromString("GeNeRaL")); | ||
assertThrows(IllegalValueException.class, () -> TagCategory.fromString("aCtIViTieS")); | ||
} | ||
} |
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