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

Fix test cases #128

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void client_no_booking_date() {
ClientBuilder clientBuilder = new ClientBuilder().withDetails(housekeepingDetails);
Client client = clientBuilder.build();

assertFalse(predicate.test(client));
assertTrue(predicate.test(client));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public EditPersonDescriptorBuilder(Person person) {
descriptor.setDetails(client.getDetails());
} else {
Housekeeper housekeeper = (Housekeeper) person;
descriptor.setBookingList(housekeeper.getBookingList());
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/test/java/housekeeping/hub/testutil/PersonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
import housekeeping.hub.logic.commands.EditCommand.EditPersonDescriptor;
import housekeeping.hub.model.person.Client;
import housekeeping.hub.model.person.Housekeeper;
import housekeeping.hub.model.person.HousekeepingDetails;
import housekeeping.hub.model.tag.Tag;

/**
* A utility class for Person.
*/
public class PersonUtil {
public static String getAddClientCommand(Client client) {
return AddClientCommand.COMMAND_WORD + " " + getClientDetails(client);
return AddClientCommand.COMMAND_WORD + " client " + getClientDetails(client);
}

public static String getAddHousekeeperCommand(Housekeeper housekeeper) {
Expand All @@ -42,7 +43,10 @@ public static String getClientDetails(Client client) {
client.getTags().stream().forEach(
s -> sb.append(PREFIX_TAG + s.tagName + " ")
);
sb.append(PREFIX_DETAILS + client.getDetails().toString());
String[] hD = HousekeepingDetails.makeStoredDetailsReadable(client.getDetails().toString()).split("\n");
String lHD = hD[0].split(" ")[2];
String pI = hD[1].split(" ")[2] + " " + hD[1].split(" ")[3];
sb.append(PREFIX_DETAILS + lHD + " " + pI);

return sb.toString();
}
Expand Down Expand Up @@ -83,7 +87,7 @@ public static String getEditPersonDescriptorDetails(EditPersonDescriptor descrip
tags.forEach(s -> sb.append(PREFIX_TAG).append(s.tagName).append(" "));
}
}
descriptor.getDetails().ifPresent(details -> sb.append(PREFIX_DETAILS).append(details.toString()));
return sb.toString();
}

}
Loading