forked from nus-cs2103-AY2324S2/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 #207 from ys112/improve-code-quality
Improve code quality
- Loading branch information
Showing
8 changed files
with
175 additions
and
50 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
21 changes: 0 additions & 21 deletions
21
src/main/java/seedu/address/model/applicant/Application.java
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
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
87 changes: 87 additions & 0 deletions
87
src/test/data/JsonAddressBookStorageTest/validApplicantHRConnect.json
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,87 @@ | ||
{ | ||
"persons" : [ { | ||
"@type" : "JsonAdaptedApplicant", | ||
"name" : "Xiao Li", | ||
"phone" : "92456721", | ||
"email" : "[email protected]", | ||
"address" : "Blk 685 Rangoon road 3, #12-09", | ||
"role" : "SWE", | ||
"stage" : "Interview", | ||
"tags" : [ ], | ||
"note" : "Forbes 30 under 30", | ||
"noteDate" : "", | ||
"img" : null | ||
}, { | ||
"@type" : "JsonAdaptedApplicant", | ||
"name" : "Alex Yeoh", | ||
"phone" : "87438807", | ||
"email" : "[email protected]", | ||
"address" : "Blk 30 Geylang Street 29, #06-40", | ||
"role" : "Frontend Engineer", | ||
"stage" : "Initial Application", | ||
"tags" : [ "friends" ], | ||
"note" : "", | ||
"noteDate" : "", | ||
"img" : null | ||
}, { | ||
"@type" : "JsonAdaptedApplicant", | ||
"name" : "Bernice Yu", | ||
"phone" : "99272758", | ||
"email" : "[email protected]", | ||
"address" : "Blk 30 Lorong 3 Serangoon Gardens, #07-18", | ||
"role" : "SWE", | ||
"stage" : "Technical Assessment", | ||
"tags" : [ "colleagues", "friends" ], | ||
"note" : "", | ||
"noteDate" : "", | ||
"img" : null | ||
}, { | ||
"@type" : "JsonAdaptedApplicant", | ||
"name" : "Charlotte Oliveiro", | ||
"phone" : "93210283", | ||
"email" : "[email protected]", | ||
"address" : "Blk 11 Ang Mo Kio Street 74, #11-04", | ||
"role" : "SWE", | ||
"stage" : "Interview", | ||
"tags" : [ "neighbours" ], | ||
"note" : "", | ||
"noteDate" : "", | ||
"img" : null | ||
}, { | ||
"@type" : "JsonAdaptedApplicant", | ||
"name" : "David Li", | ||
"phone" : "91031282", | ||
"email" : "[email protected]", | ||
"address" : "Blk 436 Serangoon Gardens Street 26, #16-43", | ||
"role" : "SWE", | ||
"stage" : "Decision & Offer", | ||
"tags" : [ "family" ], | ||
"note" : "", | ||
"noteDate" : "", | ||
"img" : null | ||
}, { | ||
"@type" : "JsonAdaptedApplicant", | ||
"name" : "Irfan Ibrahim", | ||
"phone" : "92492021", | ||
"email" : "[email protected]", | ||
"address" : "Blk 47 Tampines Street 20, #17-35", | ||
"role" : "SWE", | ||
"stage" : "Decision & Offer", | ||
"tags" : [ "classmates" ], | ||
"note" : "", | ||
"noteDate" : "", | ||
"img" : null | ||
}, { | ||
"@type" : "JsonAdaptedApplicant", | ||
"name" : "Roy Balakrishnan", | ||
"phone" : "92624417", | ||
"email" : "[email protected]", | ||
"address" : "Blk 45 Aljunied Street 85, #11-31", | ||
"role" : "SWE", | ||
"stage" : "Initial Application", | ||
"tags" : [ "colleagues" ], | ||
"note" : "", | ||
"noteDate" : "", | ||
"img" : null | ||
} ] | ||
} |
73 changes: 73 additions & 0 deletions
73
src/test/java/seedu/address/logic/commands/ImportCommandTest.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,73 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotEquals; | ||
import static seedu.address.testutil.Assert.assertThrows; | ||
import static seedu.address.testutil.TypicalApplicants.getTypicalApplicantsAddressBook; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.ModelManager; | ||
import seedu.address.model.UserPrefs; | ||
|
||
class ImportCommandTest { | ||
|
||
private static final Path TEST_DATA_FOLDER = Paths.get("src", "test", "data", "JsonAddressBookStorageTest"); | ||
|
||
private Model model; | ||
|
||
private static String getFilePathString(String fileName) { | ||
return TEST_DATA_FOLDER.resolve(fileName).toString(); | ||
} | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
model = new ModelManager(getTypicalApplicantsAddressBook(), new UserPrefs()); | ||
} | ||
|
||
@Test | ||
void execute_importValidFile_successful() throws Exception { | ||
CommandResult commandResult = new ImportCommand( | ||
getFilePathString("validApplicantHRConnect.json")).execute(model); | ||
|
||
assertEquals(ImportCommand.MESSAGE_SUCCESS, | ||
commandResult.getFeedbackToUser()); | ||
} | ||
|
||
@Test | ||
void execute_importInvalidFile_successful() throws Exception { | ||
ImportCommand importCommand = new ImportCommand( | ||
getFilePathString("invalidPersonAddressBook.json")); | ||
|
||
assertThrows(CommandException.class, ImportCommand.FILE_NOT_LOADED, () -> importCommand.execute(model)); | ||
} | ||
|
||
@Test | ||
public void equals() { | ||
String validFilePath = getFilePathString("validApplicantHRConnect.json"); | ||
ImportCommand importValidCommand = new ImportCommand(validFilePath); | ||
ImportCommand importInvalidCommand = new ImportCommand(getFilePathString("invalidPersonAddressBook.json")); | ||
|
||
// same object -> returns true | ||
assertEquals(importValidCommand, importValidCommand); | ||
|
||
// same values -> returns true | ||
ImportCommand importValidCommandCopy = new ImportCommand(validFilePath); | ||
assertEquals(importValidCommand, importValidCommandCopy); | ||
|
||
// different types -> returns false | ||
assertNotEquals(1, importValidCommand); | ||
|
||
// null -> returns false | ||
assertNotEquals(null, importValidCommand); | ||
|
||
// different file path -> returns false | ||
assertNotEquals(importValidCommand, importInvalidCommand); | ||
} | ||
} |
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