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.
Merge pull request #100 from choaticman/branch-dylan-update-test-cases-2
Add InternshipApplication tests
- Loading branch information
Showing
7 changed files
with
95 additions
and
7 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
88 changes: 88 additions & 0 deletions
88
src/test/java/seedu/address/model/internshipapplication/InternshipApplicationTest.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,88 @@ | ||
package seedu.address.model.internshipapplication; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import seedu.address.testutil.InternshipApplicationBuilder; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static seedu.address.logic.commands.CommandTestUtil.VALID_COMPANY_EMAIL_BOFA; | ||
import static seedu.address.logic.commands.CommandTestUtil.VALID_COMPANY_NAME_BOFA; | ||
import static seedu.address.logic.commands.CommandTestUtil.VALID_DATE_BOFA; | ||
import static seedu.address.logic.commands.CommandTestUtil.VALID_ROLE_BOFA; | ||
import static seedu.address.testutil.TypicalInternshipApplications.APPLE; | ||
import static seedu.address.testutil.TypicalInternshipApplications.BOFA; | ||
|
||
public class InternshipApplicationTest { | ||
|
||
@Test | ||
public void isSame() { | ||
// same object -> returns true | ||
assertTrue(APPLE.isSame(APPLE)); | ||
|
||
// null -> returns false | ||
assertFalse(APPLE.isSame(null)); | ||
|
||
// same name, all other attributes different -> returns false | ||
InternshipApplication editedApple = new InternshipApplicationBuilder(APPLE).withRole(VALID_ROLE_BOFA) | ||
.withDate(VALID_DATE_BOFA).build(); | ||
assertFalse(APPLE.isSame(editedApple)); | ||
|
||
// different name, all other attributes same -> returns false | ||
editedApple = new InternshipApplicationBuilder(APPLE).withName(VALID_COMPANY_NAME_BOFA).build(); | ||
assertFalse(APPLE.isSame(editedApple)); | ||
|
||
// name differs in case, all other attributes same -> returns true | ||
InternshipApplication editedBofa = new InternshipApplicationBuilder(BOFA).withName(VALID_COMPANY_NAME_BOFA | ||
.toLowerCase()).build(); | ||
assertTrue(BOFA.isSame(editedBofa)); | ||
|
||
// name has trailing spaces, all other attributes same -> returns true | ||
String nameWithTrailingSpaces = VALID_COMPANY_NAME_BOFA + " "; | ||
editedBofa = new InternshipApplicationBuilder(BOFA).withName(nameWithTrailingSpaces).build(); | ||
assertTrue(BOFA.isSame(editedBofa)); | ||
} | ||
|
||
@Test | ||
public void equals() { | ||
// same values -> returns true | ||
InternshipApplication appleCopy = new InternshipApplicationBuilder(APPLE).build(); | ||
assertTrue(APPLE.equals(appleCopy)); | ||
|
||
// same object -> returns true | ||
assertTrue(APPLE.equals(APPLE)); | ||
|
||
// null -> returns false | ||
assertFalse(APPLE.equals(null)); | ||
|
||
// different type -> returns false | ||
assertFalse(APPLE.equals(5)); | ||
|
||
// different person -> returns false | ||
assertFalse(APPLE.equals(BOFA)); | ||
|
||
// different company name -> returns false | ||
InternshipApplication editedApple = new InternshipApplicationBuilder(APPLE).withName(VALID_COMPANY_NAME_BOFA).build(); | ||
assertFalse(APPLE.equals(editedApple)); | ||
|
||
// different role -> returns false | ||
editedApple = new InternshipApplicationBuilder(APPLE).withRole(VALID_ROLE_BOFA).build(); | ||
assertFalse(APPLE.equals(editedApple)); | ||
|
||
// different email -> returns false | ||
editedApple = new InternshipApplicationBuilder(APPLE).withEmail(VALID_COMPANY_EMAIL_BOFA).build(); | ||
assertFalse(APPLE.equals(editedApple)); | ||
|
||
// different date -> returns false | ||
editedApple = new InternshipApplicationBuilder(APPLE).withDate("02/01/24").build(); | ||
assertFalse(APPLE.equals(editedApple)); | ||
} | ||
|
||
@Test | ||
public void toStringMethod() { | ||
String expected = InternshipApplication.class.getCanonicalName() + "{Company=" | ||
+ APPLE.getCompany() + ", Date of Application=" | ||
+ APPLE.getDateOfApplication() + ", Role=" + APPLE.getRole() + "}"; | ||
assertEquals(expected, APPLE.toString()); | ||
} | ||
} |
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