forked from nus-cs2103-AY1920S2/addressbook-level3
-
Notifications
You must be signed in to change notification settings - Fork 6
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 #136 from duongphammmm/v1.3-tests
Add tests for item field
- Loading branch information
Showing
15 changed files
with
172 additions
and
176 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package seedu.address.model.item; | ||
|
||
/*import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static seedu.address.testutil.Assert.assertThrows; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.model.item.field.Email;*/ | ||
import seedu.address.model.item.field.Email; | ||
|
||
public class EmailTest { | ||
/* | ||
@Test | ||
public void constructor_null_throwsNullPointerException() { | ||
assertThrows(NullPointerException.class, () -> new Email(null)); | ||
|
@@ -61,5 +60,4 @@ public void isValidEmail() { | |
assertTrue(Email.isValidEmail("[email protected]")); // long local part | ||
} | ||
|
||
*/ | ||
} |
83 changes: 83 additions & 0 deletions
83
src/test/java/seedu/address/model/item/InternshipTest.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,83 @@ | ||
package seedu.address.model.item; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static seedu.address.logic.commands.CommandTestUtil.VALID_INTERNSHIP_DESCRIPTION; | ||
import static seedu.address.logic.commands.CommandTestUtil.VALID_INTERNSHIP_NAME_GOOGLE; | ||
import static seedu.address.logic.commands.CommandTestUtil.VALID_INTERNSHIP_ROLE_FRONTEND; | ||
import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_JAVA; | ||
import static seedu.address.testutil.Assert.assertThrows; | ||
import static seedu.address.testutil.TypicalInternship.GOOGLE; | ||
import static seedu.address.testutil.TypicalInternship.NINJA_VAN; | ||
import static seedu.address.testutil.TypicalInternship.PAYPAL; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.testutil.InternshipBuilder; | ||
|
||
public class InternshipTest { | ||
|
||
@Test | ||
public void asObservableList_modifyList_throwsUnsupportedOperationException() { | ||
Internship internship = new InternshipBuilder().build(); | ||
assertThrows(UnsupportedOperationException.class, () -> internship.getTags().remove(0)); | ||
} | ||
|
||
@Test | ||
public void isSameInternship() { | ||
// same object -> returns true | ||
assertTrue(PAYPAL.isSame(PAYPAL)); | ||
|
||
// null -> returns false | ||
assertFalse(PAYPAL.isSame(null)); | ||
|
||
// different role and description -> returns false | ||
Internship editedPaypal = new InternshipBuilder(PAYPAL).withRole(VALID_INTERNSHIP_ROLE_FRONTEND) | ||
.withDescription(VALID_INTERNSHIP_DESCRIPTION).build(); | ||
assertFalse(PAYPAL.isSame(editedPaypal)); | ||
|
||
// different name -> returns false | ||
editedPaypal = new InternshipBuilder(PAYPAL).withName(VALID_INTERNSHIP_NAME_GOOGLE).build(); | ||
assertFalse(PAYPAL.isSame(editedPaypal)); | ||
} | ||
|
||
@Test | ||
public void equals() { | ||
// same values -> returns true | ||
Internship ninjaCopy = new InternshipBuilder(NINJA_VAN).build(); | ||
assertTrue(NINJA_VAN.equals(ninjaCopy)); | ||
|
||
// same object -> returns true | ||
assertTrue(NINJA_VAN.equals(NINJA_VAN)); | ||
|
||
// null -> returns false | ||
assertFalse(NINJA_VAN.equals(null)); | ||
|
||
// different type -> returns false | ||
assertFalse(NINJA_VAN.equals(5)); | ||
|
||
// different internship -> returns false | ||
assertFalse(NINJA_VAN.equals(GOOGLE)); | ||
|
||
// different name -> returns false | ||
Internship editedNinja = new InternshipBuilder(NINJA_VAN).withName(VALID_INTERNSHIP_NAME_GOOGLE).build(); | ||
assertFalse(NINJA_VAN.equals(editedNinja)); | ||
|
||
// different role -> returns false | ||
editedNinja = new InternshipBuilder(NINJA_VAN).withRole(VALID_INTERNSHIP_ROLE_FRONTEND).build(); | ||
assertFalse(NINJA_VAN.equals(editedNinja)); | ||
|
||
// different from -> returns false | ||
editedNinja = new InternshipBuilder(NINJA_VAN).withFrom("05-2019").build(); | ||
assertFalse(NINJA_VAN.equals(editedNinja)); | ||
|
||
// different to -> returns false | ||
editedNinja = new InternshipBuilder(NINJA_VAN).withTo("02-2018").build(); | ||
assertFalse(NINJA_VAN.equals(editedNinja)); | ||
|
||
// different tags -> returns false | ||
editedNinja = new InternshipBuilder(NINJA_VAN).withTags(VALID_TAG_JAVA).build(); | ||
assertFalse(NINJA_VAN.equals(editedNinja)); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.