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 FindFreeTime test case #276

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ This guide explains how you can use ProjectPRO to add contacts and manage your g
Here are some annotations used in this guide:




<p></p>
<div style="border-left: 4px solid #56494C; background-color: #F1DEC6; color: #000; padding: 10px; margin: 5px 0; border-radius: 6px;">
<h5 style="color: #56494C; margin: 0 0 5px 0; padding: 0;"> :heavycheckmark: Acceptable values</h5>
Expand Down Expand Up @@ -619,12 +621,14 @@ You list all available time slots of your contacts.
- Provide the full name of the contact using the `n/` prefix.
<p></p>
<div style="border-left: 4px solid #56494C; background-color: #F1DEC6; color: #000; padding: 10px; margin: 5px 0; border-radius: 6px;">
<h3 style="color: #56494C; margin: 0 0 5px 0; padding: 0;">Acceptable values</h3>
<p style="color: #000; margin: 8px 0;"><code style="color: #555; background-color: #F0C481; padding: 2px; border-radius: 2px;">NAME</code>
<h4 style="color: #56494C; margin: 0 0 5px 0; padding: 0;">Acceptable values</h4>
<p style="font-size:9px; color: #000; margin: 8px 0;"><code style="color: #555; background-color: #F0C481; padding: 2px; border-radius: 2px;">NAME</code>
must be alphanumeric and cannot be blank.</p>
</div>

<p></p>


**Example(s):**
- `listtime n/Alex Yeoh`
This lists all time slots when Alex Yeoh is available from your contact list.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,24 @@ public boolean equals(Object other) {
}

// instanceof handles nulls
if (!(other instanceof GroupPersonCommand)) {
if (!(other instanceof FindFreeTimeCommand)) {
return false;
}

GroupPersonCommand otherGroupPersonCommand = (GroupPersonCommand) other;
FindFreeTimeCommand otherFindFreeTimeCommand = (FindFreeTimeCommand) other;
// to check
return this.equals(otherGroupPersonCommand);
return this.duration.getDurationInMin() == otherFindFreeTimeCommand.duration.getDurationInMin()
&& this.groupName.equals(otherFindFreeTimeCommand.groupName);

}

// to fix
@Override
public java.lang.String toString() {
public String toString() {
return new ToStringBuilder(this)
.add("toAddToGroup", "")
.toString();
.add("group name", groupName)
.add("duration", duration.toString())
.toString();
}
}

5 changes: 5 additions & 0 deletions src/main/java/seedu/address/model/Duration.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ public int getDurationInMin() {
return this.duration;
}

public String toString() {
return Integer.toString(duration);
}


}
1 change: 1 addition & 0 deletions src/main/java/seedu/address/model/group/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public TimeIntervalList findFreeTime(Duration duration) throws CommandException
freeTime = freeTime.findOverlap(second, duration);
}
}

return freeTime;
}

Expand Down
15 changes: 15 additions & 0 deletions src/test/java/seedu/address/logic/commands/CommandTestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DURATION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_FREETIME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUPREMARK;
Expand Down Expand Up @@ -95,6 +96,20 @@ public class CommandTestUtil {
public static final String VALID_GROUP_REMARK_OTHERS = "gU4&😊!";
public static final String GROUP_REMARK_OTHERS_DESC = " " + PREFIX_GROUPREMARK + VALID_GROUP_REMARK_OTHERS;

public static final String DURATION_THIRTY = "30";
public static final String VALID_DURATION_THIRTY = " " + PREFIX_DURATION + DURATION_THIRTY;
public static final String INVALID_DURATION_NEGATIVE = "-1";
public static final String INVALID_DURATION_NEGATIVE_DESC = " " + PREFIX_DURATION + INVALID_DURATION_NEGATIVE;
public static final String INVALID_DURATION_ZERO = "0";
public static final String INVALID_DURATION_ZERO_DESC = " " + PREFIX_DURATION + INVALID_DURATION_ZERO;
public static final String INVALID_DURATION_MAX = "10080";
public static final String INVALID_DURATION_MAX_DESC = " " + PREFIX_DURATION + INVALID_DURATION_MAX;

public static final String INVALID_DURATION_CHAR = "aaa";
public static final String INVALID_DURATION_CHAR_DESC = " " + PREFIX_DURATION + INVALID_DURATION_CHAR;





/**
Expand Down
Loading
Loading