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

Delete command test, parser test and other descriptionbuilders #99

Merged
merged 6 commits into from
Oct 14, 2020

Conversation

jiaweiteo
Copy link

@jiaweiteo jiaweiteo commented Oct 12, 2020

Failing some testcases still and not sure why.
Main problem of failure is this method:

public static void showTravelPlanAtIndex(Model model, Index targetIndex) {
        assertTrue(targetIndex.getZeroBased() < model.getFilteredTravelPlanList().size());

        TravelPlan tp = model.getFilteredTravelPlanList().get(targetIndex.getZeroBased());
        final String[] splitName = tp.getName().name.split("\\s+");
        model.updateFilteredTravelPlanList(new NameContainsKeywordsPredicate(Arrays.asList(splitName[0])));

        assertEquals(1, model.getFilteredTravelPlanList().size());
    }

where the updateFilteredTravelPlanList cant seem to filter out 1 object, so the assertEquals led to false.

# Conflicts:
#	src/main/java/seedu/address/model/travelplanner/Directory.java
#	src/main/java/seedu/address/model/travelplanner/Model.java
#	src/main/java/seedu/address/model/travelplanner/ModelManager.java
#	src/test/java/seedu/address/model/activity/ActivityTest.java
#	src/test/java/seedu/address/model/activity/UniqueActivityListTest.java
#	src/test/java/seedu/address/model/commons/NameContainsKeywordsPredicateTest.java
# Conflicts:
#	src/main/java/seedu/address/logic/wanderlustlogic/wanderlustcommands/EditCommand.java
@jiaweiteo jiaweiteo added this to the v1.2 milestone Oct 12, 2020
@jiaweiteo jiaweiteo added this to In progress in v1.2 via automation Oct 12, 2020
EditActivityCommand command = (EditActivityCommand) parser.parseCommand(EditCommand.COMMAND_WORD
+ " -activity " + INDEX_FIRST_TRAVELPLAN.getOneBased() + " "
+ ActivityUtil.getEditActivityDescriptorDetails(descriptor));
assertEquals(new EditActivityCommand(INDEX_FIRST_TRAVELPLAN, descriptor), command);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is throwing an exception because the edit command ensures that at least one field is edited but the command and builder is building the exact same fields so there wasn't any editing done

Copy link
Author

Choose a reason for hiding this comment

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

Ok resolved. Thanks!


TravelPlan tp = model.getFilteredTravelPlanList().get(targetIndex.getZeroBased());
final String[] splitName = tp.getName().name.split("\\s+");
model.updateFilteredTravelPlanList(new NameContainsKeywordsPredicate(Arrays.asList(splitName[0])));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it because maybe more than 1 travel plans can have the same first name?

Copy link
Collaborator

@lyeyixian lyeyixian left a comment

Choose a reason for hiding this comment

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

LGTM

/**
* Tests that a {@code TravelPlanObject}'s or {@code TravelPlan}'s {@code Name} matches any of the keywords given.
*/
public class NameContainsKeywordsPredicate implements Predicate<Object> {
public class NameContainsKeywordsPredicate implements Predicate<TravelPlan> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this one change back to TravelPlan? It's not used in other place meh? like Activity all that

* @param travelPlanObject object to be tested.
* @return true or false.
*/
public boolean test(TravelPlanObject travelPlanObject) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I see what you did there. Works but I feel like it is not following some OOP shit or smth. But I think we come back to this later ba.

@jeannetoh99 jeannetoh99 merged commit 296607f into AY2021S1-CS2103-T14-3:master Oct 14, 2020
v1.2 automation moved this from In progress to Done Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v1.2
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants