forked from nus-cs2103-AY2223S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overriden equals for editNoteCommand,
added EditNoteCommand testcases
- Loading branch information
Showing
5 changed files
with
264 additions
and
2 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
70 changes: 70 additions & 0 deletions
70
src/test/java/seedu/address/testutil/EditNoteDescriptorBuilder.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,70 @@ | ||
package seedu.address.testutil; | ||
|
||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import seedu.address.logic.commands.EditNoteCommand.EditNoteDescriptor; | ||
import seedu.address.model.note.Content; | ||
import seedu.address.model.note.Note; | ||
import seedu.address.model.note.Title; | ||
import seedu.address.model.tag.Tag; | ||
|
||
/** | ||
* A utility class to help with building EditNoteDescriptor objects. | ||
*/ | ||
public class EditNoteDescriptorBuilder { | ||
|
||
private EditNoteDescriptor descriptor; | ||
|
||
public EditNoteDescriptorBuilder() { | ||
descriptor = new EditNoteDescriptor(); | ||
} | ||
|
||
public EditNoteDescriptorBuilder(EditNoteDescriptor descriptor) { | ||
this.descriptor = new EditNoteDescriptor(descriptor); | ||
} | ||
|
||
/** | ||
* Returns an {@code EditNoteDescriptor} with fields containing {@code note}'s details | ||
*/ | ||
public EditNoteDescriptorBuilder(Note note) { | ||
descriptor = new EditNoteDescriptor(); | ||
descriptor.setTitle(note.getTitle()); | ||
descriptor.setContent(note.getContent()); | ||
descriptor.setTags(note.getTags()); | ||
} | ||
|
||
/** | ||
* Sets the {@code Title} of the {@code EditNoteDescriptor} that we are building. | ||
*/ | ||
public EditNoteDescriptorBuilder withTitle(String title) { | ||
descriptor.setTitle(new Title(title)); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Content} of the {@code EditNoteDescriptor} that we are building. | ||
*/ | ||
public EditNoteDescriptorBuilder withContent(String content) { | ||
descriptor.setContent(new Content(content)); | ||
return this; | ||
} | ||
|
||
/** | ||
* Parses the {@code tags} into a {@code Set<Tag>} and set it to the {@code EditNoteDescriptor} | ||
* that we are building. | ||
*/ | ||
public EditNoteDescriptorBuilder withTags(String... tags) { | ||
Set<Tag> tagSet = Stream.of(tags).map(Tag::new).collect(Collectors.toSet()); | ||
descriptor.setTags(tagSet); | ||
return this; | ||
} | ||
|
||
public EditNoteDescriptor build() { | ||
return descriptor; | ||
} | ||
|
||
|
||
|
||
} |
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