Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for ViewAllCommand and ViewCommand classes #111 #131

Merged
merged 44 commits into from
Jan 17, 2017

Conversation

zzzzwen
Copy link
Contributor

@zzzzwen zzzzwen commented Dec 29, 2016

code ideas and format follow DeleteCommandTest

Adding header comments later

For ViewAll command, should I do it in a separate file or together with view command

Fixes #111

@damithc
Copy link
Contributor

damithc commented Dec 30, 2016

@zzzzwen

For ViewAll command, should I do it in a separate file or together with view command

Usually, we have one test class for each functional class

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Dec 30, 2016

Ready for review,

two tests are roughly the same

Here are some of my questions:

in ViewCommandTest:
assertViewSuccess, assertViewErrorInvalidIndex, assertViewErrorPersonNotInAddressBook are actually the same except the expected message is different, should I inline all three?

assertCommandResult this method can be quite general by just asserting the result message, if modify a bit, can move it to TestUtil class?

Same things apply to ViewAllCommandTest

Copy link
Contributor

@damithc damithc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments to one test class. Can revise the other based on the same comments.

new Phone("1234567", true),
new Email("[email protected]", false),
new Address("Newgate Prison", true),
new UniqueTagList(new Tag("friend"), new Tag("criminal")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two persons is a bit a special case because the list doesn't have persons in the middle. A 3-person list is more general.

emptyDisplayList = TestUtil.createList();
listWithAll = TestUtil.createList(johnDoe, betsyCrowe);
listWithSome = TestUtil.createList(betsyCrowe);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract into a TypicalPersons utility class?

// non-empty addressbook
assertViewAllErrorInvalidIndex(addressBook, listWithAll, -1);
assertViewAllErrorInvalidIndex(addressBook, listWithAll, 0);
assertViewAllErrorInvalidIndex(addressBook, listWithAll, 3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use size()+1 of the list instead of magic number 3, the test will be less brittle (less likely to break in future).

* Executes the command, and asserts the result message is as expected.
*/
private void assertCommandResult(Command command, String expectedMessage,
AddressBook addressBook) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this line break?

* and displayed.
*/
private void assertViewAllSuccess(AddressBook addressBook, List<ReadOnlyPerson> list, int index) {
String expectedMessage = String.format(ViewAllCommand.MESSAGE_VIEW_PERSON_DETAILS, list.get(index - 1).getAsTextShowAll());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line too long?

@damithc
Copy link
Contributor

damithc commented Dec 30, 2016

@zzzzwen Yes, you can move common methods to TestUtil class.

e.printStackTrace();
assert false : "not possible";
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another similar class in #120 that might be merged before this. May be you can follow the same? Note how the person names follow a pattern. e.g. First person has initials A B, second one B C, and so on. Even the address follows a pattern and not random. Such patterns help us detect when things go out of place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@damithc So I wait for the other pr to merge first then use and edit his TypicalPersons for the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we both have same class created

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That class is mostly stable now, so you can copy-paste-modify that code into your and continue with your PR. If that PR is merged first, you'll have to update your branch and de-conflict your class a bit at that point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Dec 30, 2016

Updated, I will leave it here first, after merging #120 I will resolve the conflict

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 3, 2017

Updated, ready for review

Copy link
Contributor

@damithc damithc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments added.

public void setUp() throws Exception {
TypicalPersons td = new TypicalPersons();

emptyAddressBook = TestUtil.createAddressBook();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be initialized at the same place it's declared. Junit creates a new instance for each test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@damithc This TestUtil.createAddressBook() is throwing an excpetion in TestUtil Class so cannot put outside right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case can keep.

TypicalPersons td = new TypicalPersons();

emptyAddressBook = TestUtil.createAddressBook();
addressBook = td.getTypicalAddressBook();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was intended for the line below. Sorry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note #134


emptyDisplayList = TestUtil.createList();
listWithAll = td.getListWithAllPersons();
listWithSome = td.getListWithSomePersons();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a related note, lines 32, 35, 38, 39, should have been put together as they are connected. i.e. declaring a variable and then using it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted

}

/**
* Asserts that the details person at specific index can be successfully retrieved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

details of the?


Command command = generateViewAllCommand(addressBook, list, index);
assertCommandResult(command, expectedMessage, addressBook, TestUtil.clone(addressBook));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the common part of the above two methods can be extracted as a method?

Command command = generateViewCommand(addressBook, list, index);
assertCommandResult(command, expectedMessage, addressBook, TestUtil.clone(addressBook));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this class is almost the same as the other test class, we can text both commands in one of the class and make the other class empty with just a comment to explain why it is empty.

* Executes the command, and asserts the result message is as expected.
*/
public static void assertCommandResult(Command command, String expectedMessage, AddressBook addressBook,
AddressBook expectedAddressBook) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More readable indentation:

public static void assertCommandResult(Command command, String expectedMessage, AddressBook addressBook, 
                                                                         AddressBook expectedAddressBook) {

return list;
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a line feed at the end of the file

return ab;
}

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this is shown as a diff. Most of it looks identical.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, this is because there is an extra whitespace for each line, sorry

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 4, 2017

Updated

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 4, 2017

Removed use of TestUtil.createList()

Copy link
Contributor

@damithc damithc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better. Some comments added.

assertViewSuccess(addressBook, listWithAll, 1);

// person with some private information
assertViewSuccess(addressBook, listWithAll, 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need a person with all info private, to confirm that 'privacy' works for each relevant field.

Copy link
Contributor Author

@zzzzwen zzzzwen Jan 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@damithc In TypicalPersons I have a person called dan, all the information which has the private/public option for him is private.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant such a person must be included as one of the test cases in this method. Your comment in line 74 says some private information so I guess that's not dan.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I get it

}

/**
* Creates a new View command.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ViewCommand

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this comment doesn't add much value. Can be removed.


expectedMessage = String.format(ViewCommand.MESSAGE_VIEW_PERSON_DETAILS,
list.get(index - 1).getAsTextShowAll());
assertViewAllCommandBehaviour(addressBook, list, expectedMessage, index);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index - 1 appears twice. Assign to local variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that a new local variable, eg, pos = index - 1 doesn't add much value since index-1 just refer to the position in the list and won't be changed. Is it necessary to extract to a local variable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By local, I meant inside the method. Reasons,

  1. It's not good when a calculation is duplicated.
  2. its meaning is not immediately clear.

Something like this will help clear both problems.

int internalIndex = index - 1; // because index is one-indexed

String expectedMessage = Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX;

assertViewCommandBehaviour(addressBook, list, expectedMessage, index);
assertViewAllCommandBehaviour(addressBook, list, expectedMessage, index);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified as this (after extracting common part of this and next method)?
assertCommandError(addressBook, list, index, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX)

/**
* Asserts that the View command gives correct feedback information
*/
private void assertViewCommandBehaviour(AddressBook addressBook, List<ReadOnlyPerson> list, String message, int index) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reorder parameters so that the three input values come first?
message -> expectedMessage

* Executes the command, and asserts the result message is as expected.
*/
public static void assertCommandResult(Command command, String expectedMessage, AddressBook addressBook,
AddressBook expectedAddressBook) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, can reorder parameters so that input comes first and expected values come next.

import seedu.addressbook.data.tag.UniqueTagList;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra space?

List<ReadOnlyPerson> list = getListWithAllPersons();
list.remove(0); //remove a person in the list
return list;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is very specific to your test class and therefore not a good abstraction. Try something like this instead:
public List<ReadOnlyPerson> getList(ReadOnlyPerson... personsToInclude);

Can be used like this:
getList(td.amy, td.candy);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 8, 2017

Updated, but ViewCommand and ViewAllCommand are two separate commands and my original idea is to split them into two different blocks of methods to show they are different.

Copy link
Contributor

@pyokagan pyokagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please configure your editor to strip all trailing whitespace and mark out the 110 character boundary.

* Asserts that the ViewCommand and ViewAllCommand show given feedback information
*/
private static void assertViewBehavior(Command viewCommand, AddressBook addressBook,
List<ReadOnlyPerson> list, String expectedMessage) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent this further to the right.

@@ -75,4 +78,5 @@ public static void assertTextFilesEqual(Path path1, Path path2) throws IOExcepti
List<String> list2 = Files.readAllLines(path2, Charset.defaultCharset());
assertEquals(String.join("\n", list1), String.join("\n", list2));
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary change.


public class ViewCommandTest {
private TypicalPersons td = new TypicalPersons();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace

// non-empty addressbook
assertViewErrorInvalidIndex(typicalAddressBook, displayListWithAllTypicalPersons, -1);
assertViewErrorInvalidIndex(typicalAddressBook, displayListWithAllTypicalPersons, 0);
assertViewErrorInvalidIndex(typicalAddressBook, displayListWithAllTypicalPersons, displayListWithAllTypicalPersons.size() + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overlong line way above 110 chars.

new Email("[email protected]", true),
new Address("nus", false),
new UniqueTagList(Collections.emptySet()));
List <ReadOnlyPerson> displayListWithExtraPerson = new ArrayList<ReadOnlyPerson>(displayListWithAllTypicalPersons);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overlong line way above 110 chars.

assertViewErrorPersonNotInAddressBook(emptyAddressBook, displayListWithExtraPerson, 1);

// non-empty addressbook
assertViewErrorPersonNotInAddressBook(typicalAddressBook, displayListWithExtraPerson, displayListWithExtraPerson.size());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overlong line way above 110 chars.

/**
* Asserts that both a ViewCommand and a ViewAllCommand can retrieve from
* the {@code addressBook} details of the person at the given {@code index} in the given {@code list}.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace.

@pyokagan
Copy link
Contributor

pyokagan commented Jan 8, 2017

@zzzzwen I notice you are still using the displayList terminology in your code. As I noted previously, this is inconsistent with the terminology already in use (relevantPersons).

Maybe displayList is a better name ( I personally think that relevantPersons is not such a great term, but I'm not so sure that displayList is a good replacement either. @damithc What do you think? ) But if so, you need to commit to changing all instances of relevantPersons in the code base to use your displayList terminology. Are you up to the task? If so, make sure you open up an issue for that.

Otherwise, please change all your naming to use relevantPersons.

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 9, 2017

Configured and updated. Replaced all with parameters in Command

Copy link
Contributor

@pyokagan pyokagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still lots of references to displayList in the code. I've suggested some alternatives, or you can think up of your own as long as they don't introduce new terminology not used in the existing code base.


private AddressBook typicalAddressBook = td.getTypicalAddressBook();
private AddressBook emptyAddressBook = TestUtil.createAddressBook();
private List<ReadOnlyPerson> emptyDisplayList = Collections.emptyList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename emptyDisplayList to emptyPersonList.

private AddressBook typicalAddressBook = td.getTypicalAddressBook();
private AddressBook emptyAddressBook = TestUtil.createAddressBook();
private List<ReadOnlyPerson> emptyDisplayList = Collections.emptyList();
private List<ReadOnlyPerson> displayListWithAllTypicalPersons = Arrays.asList(td.getTypicalPersons());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename displayListWithAllTypicalPersons to allTypicalPersonsList or listWithAllTypicalPersons.

private AddressBook emptyAddressBook = TestUtil.createAddressBook();
private List<ReadOnlyPerson> emptyDisplayList = Collections.emptyList();
private List<ReadOnlyPerson> displayListWithAllTypicalPersons = Arrays.asList(td.getTypicalPersons());
private List<ReadOnlyPerson> listWithSome = Arrays.asList(td.amy, td.candy, td.dan);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename listWithSome to listWithSomeTypicalPersons.

new Email("[email protected]", true),
new Address("nus", false),
new UniqueTagList(Collections.emptySet()));
List <ReadOnlyPerson> displayListWithExtraPerson
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can just be listWithExtraPerson. Also, remove the space in List <ReadOnlyPerson>.


@Test
public void execute_personNotInAddressBook_returnsPersonNotInAddressBookMessage() throws Exception {
// generate person not in addressbook, add to displayList
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More descriptive: generate list with person not in addressbook.

* Asserts that the details of person at specific index cannot be retrieved due to
* invalid index.
*/
private void assertViewErrorInvalidIndex(AddressBook addressBook, List<ReadOnlyPerson> list,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename list to relevantPersons.

* Asserts that the details of person at specific index cannot be retrieved due to
* person not existing in the addressbook.
*/
private void assertViewErrorPersonNotInAddressBook(AddressBook addressBook, List<ReadOnlyPerson> list,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename list to relevantPersons.

}

/**
* Asserts that the ViewCommand and ViewAllCommand show given feedback information
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not just check for feedback information. You may wish to enumerate the list of things it checks for, e.g.

Checks that viewCommand exhibits the correct view command behavior, namely:

1. The feedback message of the CommandResult it returns matches expectedMessage
2. The CommandResult it returns has no relevant persons.
3. ...

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 9, 2017

Updated, the displayList in the assertViewErrorInvalidIndex and assertViewErrorPersonNotInAddressBook are not changed in the previous commits because the terminology relevantPersons is for constructing the Command and those two in the methods still don't touch the Command yet, so I didn't change them in the two methods.

Copy link
Contributor

@pyokagan pyokagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, just a few nits. I think everything else looks fine.


/**
* Asserts that both a ViewCommand and a ViewAllCommand can retrieve from
* the {@code addressBook} details of the person at the given {@code index} in the given {@code list}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change {@code index} to {@code targetVisibleIndex}?

Change {@code list} to {@code relevantPersons} list?

*/
private void assertViewErrorInvalidIndex(AddressBook addressBook, List<ReadOnlyPerson> relevantPersons,
int targetVisibleIndex) {
assertViewError(addressBook, relevantPersons, targetVisibleIndex, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is much longer than 110 chars.

*/
private void assertViewSuccess(AddressBook addressBook, List<ReadOnlyPerson> relevantPersons,
int targetVisibleIndex) {
ReadOnlyPerson personToBeViewed = relevantPersons.get(targetVisibleIndex - 1); // -1 is because index is one-indexed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is much longer than 110 chars.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could put it like that:

        // -1 is because index is one-indexed
        ReadOnlyPerson personToBeViewed = relevantPersons.get(targetVisibleIndex - 1);

but imo that looks weird because usually a comment at the code block describes what the code below overall does, but in this case all we are doing is just commenting on the use of -1.

So maybe we need to add a description on what the code below does, even though it may be obvious. So something like:

        // Get person to be viewed (targetVisibleIndex - 1 because index is one-indexed)
        ReadOnlyPerson personToBeViewed = relevantPersons.get(targetVisibleIndex - 1);

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 13, 2017

Updated

@damithc
Copy link
Contributor

damithc commented Jan 13, 2017

@zzzzwen the Fixes #... info is missing from the PR description.

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 13, 2017

oh, added

Copy link
Contributor

@pyokagan pyokagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

@pyokagan
Copy link
Contributor

@damithc Can reconfirm your approval? PR has changed since your last review.

Copy link
Contributor

@damithc damithc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. A few cosmetic nits only.

assertViewErrorInvalidIndex(typicalAddressBook, listWithAllTypicalPersons, -1);
assertViewErrorInvalidIndex(typicalAddressBook, listWithAllTypicalPersons, 0);
assertViewErrorInvalidIndex(typicalAddressBook, listWithAllTypicalPersons,
listWithAllTypicalPersons.size() + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: indent for better readability. This way, ( and ) that demarcate the parameter list appear on far left and far right of the parameters, respectively.

 assertViewErrorInvalidIndex(typicalAddressBook, listWithAllTypicalPersons,
                                       listWithAllTypicalPersons.size() + 1);

This applies to a few other places as well.

@Test
public void execute_personNotInAddressBook_returnsPersonNotInAddressBookMessage() throws Exception {
// generate list with person not in addressbook, add to list
ReadOnlyPerson someone = new Person(new Name("me"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone --> stranger?

assertViewSuccess(typicalAddressBook, listWithAllTypicalPersons, 4);

// addressbook has more people than the list
// This can happen when view from filtered list caused by some commands(eg. FindCommand)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is not very clear.
This can happen when a command causes the list to show only a sub-set of persons (e.g. FindCommand).

Also, full sentences should end with full stop.

*/
private void assertViewSuccess(AddressBook addressBook, List<ReadOnlyPerson> relevantPersons,
int targetVisibleIndex) {
// Get person to be viewed (targetVisibleIndex - 1 because index is one-indexed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get (to be consistent with other comments in this class)?

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 15, 2017

Updated

Copy link
Contributor

@damithc damithc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor nit remaining

// addressbook has more people than the list
// This can happen when view from filtered list caused by some commands(eg. FindCommand)
// addressbook has more people than the list.
// this can happen when a command causes the list to show only a sub-set of persons(e.g. FindCommand).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full sentences should start with a upper case letter too. :-) So it should either a full sentence starting with a upper case letter and ending with a full stop, or just a short phrase starting with a lower case letter and no full stop at the end.

@zzzzwen
Copy link
Contributor Author

zzzzwen commented Jan 15, 2017

ok

@pyokagan
Copy link
Contributor

@damithc Any more comments for this PR?

@pyokagan pyokagan merged commit f92b1d0 into se-edu:master Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants