Skip to content

Commit

Permalink
Merge pull request #134 from jeffreygohkw/week12docs
Browse files Browse the repository at this point in the history
[V1.5] Update UG and DG
  • Loading branch information
jeffreygohkw authored Nov 7, 2017
2 parents 38e8e17 + c236a1c commit d475144
Show file tree
Hide file tree
Showing 15 changed files with 3,454 additions and 643 deletions.
679 changes: 498 additions & 181 deletions collated/main/Esilocke.md

Large diffs are not rendered by default.

649 changes: 585 additions & 64 deletions collated/main/charlesgoh.md

Large diffs are not rendered by default.

1,037 changes: 830 additions & 207 deletions collated/main/jeffreygohkw.md

Large diffs are not rendered by default.

565 changes: 535 additions & 30 deletions collated/test/Esilocke.md

Large diffs are not rendered by default.

331 changes: 331 additions & 0 deletions collated/test/charlesgoh.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,337 @@ public class TaskListPanelHandle extends NodeHandle<ListView<TaskCard>> {
}
}
```
###### \java\seedu\address\logic\commands\AddCommandTest.java
``` java
public void increaseFontSize() {
fail("This method should not be called.");
}

public void decreaseFontSize() {
fail("This method should not be called.");
}

public void resetFontSize() {
fail("This method should not be called.");
}

public void setMainWindow(MainWindow mainWindow) {
fail("This method should not be called.");
}
```
###### \java\seedu\address\logic\parser\AddressBookParserTest.java
``` java
@Test
public void parseSortCommandWord() throws Exception {
assertTrue(parser.parseCommand(SortCommand.COMMAND_WORD + " "
+ SortCommand.ACCEPTED_LIST_PARAMETERS.get(0) + " " + SortCommand.ACCEPTED_FIELD_PARAMETERS.get(0)
+ " " + SortCommand.ACCEPTED_ORDER_PARAMETERS.get(0)) instanceof SortCommand);
}

@Test
public void parseSortCommandAlias() throws Exception {
assertTrue(parser.parseCommand(SortCommand.COMMAND_ALIAS + " "
+ SortCommand.ACCEPTED_LIST_PARAMETERS.get(0) + " " + SortCommand.ACCEPTED_FIELD_PARAMETERS.get(0)
+ " " + SortCommand.ACCEPTED_ORDER_PARAMETERS.get(0)) instanceof SortCommand);
}

@Test
public void parseCommandBackup() throws Exception {
assertTrue(parser.parseCommand(BackupCommand.COMMAND_WORD + " testbackupfilename") instanceof BackupCommand);
assertTrue(parser.parseCommand(BackupCommand.COMMAND_ALIAS + " testbackupfilename") instanceof BackupCommand);
}

@Test
public void parseCommandFontSizeWord() throws Exception {
for (String arg: FontSizeCommand.ACCEPTED_PARAMETERS) {
assertTrue(parser
.parseCommand(FontSizeCommand.COMMAND_WORD + " " + arg) instanceof FontSizeCommand);
}

}

@Test
public void parseCommandFontSizeAlias() throws Exception {
for (String arg: FontSizeCommand.ACCEPTED_PARAMETERS) {
assertTrue(parser
.parseCommand(FontSizeCommand.COMMAND_ALIAS + " " + arg) instanceof FontSizeCommand);
}

}

```
###### \java\seedu\address\logic\parser\SortCommandParserTest.java
``` java
}
```
###### \java\seedu\address\model\UniquePersonListTest.java
``` java
@Test
public void sortPerson_byName_bothOrders() {
// Set up expected result
List<ReadOnlyPerson> personList = TypicalPersons.getTypicalPersons();
Comparator<ReadOnlyPerson> nameComparator = new Comparator<ReadOnlyPerson>() {
@Override
public int compare(ReadOnlyPerson o1, ReadOnlyPerson o2) {
return o1.getName().fullName.compareTo(o2.getName().fullName);
}
};
Collections.sort(personList, nameComparator);
ObservableList<ReadOnlyPerson> expectedTaskList = FXCollections.observableList(personList);

// Set up actual result
AddressBook addressBook = TypicalPersons.getTypicalPersonsAddressBook();
addressBook.sortPersonsBy("name", "asc");
ObservableList<ReadOnlyPerson> actualTaskList = addressBook.getPersonList();

// Check ascending order sort
assertEquals(expectedTaskList, actualTaskList);

// Set up descending order sort
Collections.sort(personList, Collections.reverseOrder(nameComparator));
expectedTaskList = FXCollections.observableList(personList);
addressBook.sortPersonsBy("name", "desc");
actualTaskList = addressBook.getPersonList();

// Check descending order sort
assertEquals(expectedTaskList, actualTaskList);
}

@Test
public void sortPerson_byPhone_bothOrders() {
// Set up expected result
List<ReadOnlyPerson> personList = TypicalPersons.getTypicalPersons();
Comparator<ReadOnlyPerson> phoneComparator = new Comparator<ReadOnlyPerson>() {
@Override
public int compare(ReadOnlyPerson o1, ReadOnlyPerson o2) {
return o1.getPhone().value.compareTo(o2.getPhone().value);
}
};
Collections.sort(personList, phoneComparator);
ObservableList<ReadOnlyPerson> expectedTaskList = FXCollections.observableList(personList);

// Set up actual result
AddressBook addressBook = TypicalPersons.getTypicalPersonsAddressBook();
addressBook.sortPersonsBy("phone", "asc");
ObservableList<ReadOnlyPerson> actualTaskList = addressBook.getPersonList();

// Check ascending order sort
assertEquals(expectedTaskList, actualTaskList);

// Set up descending order sort
Collections.sort(personList, Collections.reverseOrder(phoneComparator));
expectedTaskList = FXCollections.observableList(personList);
addressBook.sortPersonsBy("phone", "desc");
actualTaskList = addressBook.getPersonList();

// Check descending order sort
assertEquals(expectedTaskList, actualTaskList);
}

@Test
public void sortPerson_byEmail_bothOrders() {
// Set up expected result
List<ReadOnlyPerson> personList = TypicalPersons.getTypicalPersons();
Comparator<ReadOnlyPerson> emailComparator = new Comparator<ReadOnlyPerson>() {
@Override
public int compare(ReadOnlyPerson o1, ReadOnlyPerson o2) {
return o1.getEmail().value.compareTo(o2.getEmail().value);
}
};
Collections.sort(personList, emailComparator);
ObservableList<ReadOnlyPerson> expectedTaskList = FXCollections.observableList(personList);

// Set up actual result
AddressBook addressBook = TypicalPersons.getTypicalPersonsAddressBook();
addressBook.sortPersonsBy("email", "asc");
ObservableList<ReadOnlyPerson> actualTaskList = addressBook.getPersonList();

// Check ascending order sort
assertEquals(expectedTaskList, actualTaskList);

// Set up descending order sort
Collections.sort(personList, Collections.reverseOrder(emailComparator));
expectedTaskList = FXCollections.observableList(personList);
addressBook.sortPersonsBy("email", "desc");
actualTaskList = addressBook.getPersonList();

// Check descending order sort
assertEquals(expectedTaskList, actualTaskList);
}

@Test
public void sortPerson_byAddress_bothOrders() {
// Set up expected result
List<ReadOnlyPerson> personList = TypicalPersons.getTypicalPersons();
Comparator<ReadOnlyPerson> addressComparator = new Comparator<ReadOnlyPerson>() {
@Override
public int compare(ReadOnlyPerson o1, ReadOnlyPerson o2) {
return o1.getAddress().value.compareTo(o2.getAddress().value);
}
};
Collections.sort(personList, addressComparator);
ObservableList<ReadOnlyPerson> expectedTaskList = FXCollections.observableList(personList);

// Set up actual result
AddressBook addressBook = TypicalPersons.getTypicalPersonsAddressBook();
addressBook.sortPersonsBy("address", "asc");
ObservableList<ReadOnlyPerson> actualTaskList = addressBook.getPersonList();

// Check ascending order sort
assertEquals(expectedTaskList, actualTaskList);

// Set up descending order sort
Collections.sort(personList, Collections.reverseOrder(addressComparator));
expectedTaskList = FXCollections.observableList(personList);
addressBook.sortPersonsBy("address", "desc");
actualTaskList = addressBook.getPersonList();

// Check descending order sort
assertEquals(expectedTaskList, actualTaskList);
}
```
###### \java\seedu\address\model\UniqueTaskListTest.java
``` java
public class UniqueTaskListTest {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Test
public void asObservableList_modifyList_throwsUnsupportedOperationException() {
UniqueTaskList uniquePersonList = new UniqueTaskList();
thrown.expect(UnsupportedOperationException.class);
uniquePersonList.asObservableList().remove(0);
}

@Test
public void sortTasks_byDeadline_bothOrders() {
// Set up expected result
List<ReadOnlyTask> taskList = TypicalTasks.getTypicalTasks();
Comparator<ReadOnlyTask> deadlineComparator = new Comparator<ReadOnlyTask>() {
@Override
public int compare(ReadOnlyTask o1, ReadOnlyTask o2) {
return o1.getDeadline().date.compareTo(o2.getDeadline().date);
}
};
Collections.sort(taskList, deadlineComparator);
ObservableList<ReadOnlyTask> expectedTaskList = FXCollections.observableList(taskList);

// Set up actual result
AddressBook addressBook = TypicalTasks.getTypicalTasksOnlyAddressBook();
addressBook.sortTasksBy("deadline", "asc");
ObservableList<ReadOnlyTask> actualTaskList = addressBook.getTasksList();

// Check ascending order sort
assertEquals(expectedTaskList, actualTaskList);

// Set up descending order sort
Collections.sort(taskList, Collections.reverseOrder(deadlineComparator));
expectedTaskList = FXCollections.observableList(taskList);
addressBook.sortTasksBy("deadline", "desc");
actualTaskList = addressBook.getTasksList();

// Check descending order sort
assertEquals(expectedTaskList, actualTaskList);
}

@Test
public void sortTasks_byPriority_bothOrders() {
// Set up expected result
List<ReadOnlyTask> taskList = TypicalTasks.getTypicalTasks();
Comparator<ReadOnlyTask> deadlineComparator = new Comparator<ReadOnlyTask>() {
@Override
public int compare(ReadOnlyTask o1, ReadOnlyTask o2) {
return Integer.compare(o1.getPriority().value, o2.getPriority().value);
}
};
Collections.sort(taskList, deadlineComparator);
ObservableList<ReadOnlyTask> expectedTaskList = FXCollections.observableList(taskList);

// Set up actual result
AddressBook addressBook = TypicalTasks.getTypicalTasksOnlyAddressBook();
addressBook.sortTasksBy("priority", "asc");
ObservableList<ReadOnlyTask> actualTaskList = addressBook.getTasksList();

// Check ascending order sort
assertEquals(expectedTaskList, actualTaskList);

// Set up descending order sort
Collections.sort(taskList, Collections.reverseOrder(deadlineComparator));
expectedTaskList = FXCollections.observableList(taskList);
addressBook.sortTasksBy("priority", "desc");
actualTaskList = addressBook.getTasksList();

// Check descending order sort
assertEquals(expectedTaskList, actualTaskList);
}
}
```
###### \java\seedu\address\testutil\EditPersonDescriptorBuilder.java
``` java
/**
* Sets the {@code Remark} of the {@code EditPersonDescriptor} that we are building.
*/
public EditPersonDescriptorBuilder withRemark(String remark) {
try {
ParserUtil.parseRemark(Optional.of(remark)).ifPresent(descriptor::setRemark);
} catch (IllegalValueException ive) {
throw new IllegalArgumentException("remark is expected to be unique.");
}
return this;
}

/**
* Sets the {@code Avatar} of the {@code EditPersonDescriptor} that we are building.
*/
public EditPersonDescriptorBuilder withAvatar(String avatar) {
try {
ParserUtil.parseAvatar(Optional.of(avatar)).ifPresent(descriptor::setAvatar);
} catch (IllegalValueException ive) {
throw new IllegalArgumentException("avatar is expected to be unique.");
}
return this;
}
//@author

/**
* Parses the {@code tags} into a {@code Set<Tag>} and set it to the {@code EditPersonDescriptor}
* that we are building.
*/
public EditPersonDescriptorBuilder withTags(String... tags) {
try {
descriptor.setTags(ParserUtil.parseTags(Arrays.asList(tags)));
} catch (IllegalValueException ive) {
throw new IllegalArgumentException("tags are expected to be unique.");
}
return this;
}
```
###### \java\seedu\address\testutil\PersonBuilder.java
``` java
/**
* Sets the {@code Phone} of the {@code Person} that we are building.
*/
public PersonBuilder withRemark(String remark) {
try {
this.person.setRemark(new Remark(remark));
} catch (IllegalValueException ive) {
throw new IllegalArgumentException("Remark is invalid");
}
return this;
}

/**
* Sets the {@code Phone} of the {@code Person} that we are building.
*/
public PersonBuilder withAvatar(String filepath) {
try {
this.person.setAvatar(new Avatar(filepath));
} catch (IllegalValueException ive) {
throw new IllegalArgumentException("Avatar is invalid");
}
return this;
}
```
###### \java\seedu\address\ui\PersonCardTest.java
``` java
@Test
Expand Down
Loading

0 comments on commit d475144

Please sign in to comment.