Skip to content

Commit

Permalink
Merge pull request #183
Browse files Browse the repository at this point in the history
Create test util
  • Loading branch information
NereusWB922 authored Oct 30, 2023
2 parents b73024e + f4022d0 commit c65ac71
Show file tree
Hide file tree
Showing 24 changed files with 769 additions and 857 deletions.
17 changes: 14 additions & 3 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,26 @@ public class ModelManager implements Model {
private AbsolutePath displayPath;

/**
* Construct a model manager with curren path, root (ProfBook) and userPrefs.
* Construct a model manager with current path, root (ProfBook) and userPrefs.
*/
public ModelManager(AbsolutePath currentPath, Root root, ReadOnlyUserPrefs userPrefs) {
requireAllNonNull(currentPath, root, userPrefs);
this.currentPath = currentPath;
this.displayPath = currentPath;
this.root = root;
updateList();
this.root = new Root(root);
this.userPrefs = new UserPrefs(userPrefs);
updateList();
}

/**
* Constructs a model manager with all fields.
*/
public ModelManager(AbsolutePath currPath, Root root, ReadOnlyUserPrefs usePrefs,
AbsolutePath displayPath, boolean showTaskList) {
this(currPath, root, usePrefs);
this.displayPath = displayPath;
this.showTaskList = showTaskList;
updateList();
}

//=========== UserPrefs ==================================================================================
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/seedu/address/model/field/EditGroupDescriptor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package seedu.address.model.field;

import java.util.Objects;
import java.util.Optional;

import seedu.address.commons.util.CollectionUtil;
Expand Down Expand Up @@ -90,13 +91,9 @@ public boolean equals(Object other) {
}

EditGroupDescriptor otherEditGroupDescriptor = (EditGroupDescriptor) other;
if (this.name == null || otherEditGroupDescriptor.name == null) {
return false;
}
if (this.id == null || otherEditGroupDescriptor.id == null) {
return false;
}
return this.name.equals(otherEditGroupDescriptor.name) && this.id.equals(otherEditGroupDescriptor.id);

return Objects.equals(this.name, otherEditGroupDescriptor.name)
&& Objects.equals(this.id, otherEditGroupDescriptor.id);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/task/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
public class Deadline extends Task {
private static final DateTimeFormatter OUTPUT_DATETIME_FORMATTER =
DateTimeFormatter.ofPattern("EEEE, MMMM d, yyyy h:mm a");
DateTimeFormatter.ofPattern("EEEE, MMMM d, yyyy hh:mm a");
private final LocalDateTime dueBy;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import seedu.address.logic.parser.ParserUtil;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.path.AbsolutePath;
import seedu.address.model.path.RelativePath;
import seedu.address.model.path.exceptions.InvalidPathException;
Expand Down Expand Up @@ -151,8 +152,9 @@ public static void assertCommandSuccess(Command command, Model actualModel, Stri
* - the CommandException message matches {@code expectedMessage} <br>
* - the {@code actualModel} remain unchanged
*/
public static void assertCommandFailure(Command command, Model actualModel,
String expectedMessage, Model unchangedModel) {
public static void assertCommandFailure(Command command, Model actualModel, String expectedMessage) {
Model unchangedModel = new ModelManager(actualModel.getCurrPath(), actualModel.getRoot(),
actualModel.getUserPrefs(), actualModel.getDisplayPath(), actualModel.isShowTaskList());
assertThrows(CommandException.class, () -> command.execute(actualModel), expectedMessage);
assertEquals(unchangedModel, actualModel);
}
Expand Down
Loading

0 comments on commit c65ac71

Please sign in to comment.