Skip to content

Commit

Permalink
Create Seller and Buyer classes with add commands and test cases
Browse files Browse the repository at this point in the history
Currently, there are no specific classes for representing
sellers and buyers in the address book application.

To differentiate between sellers and buyers in the address book
application and to allow for specific functionalities and
attributes for each.

Two new classes, Seller and Buyer, are created as subclasses of the
Person class. Each class has its own add command and test cases to
ensure proper functionality.

Subclassing from the Person class allows for code reuse and maintains
consistency in the application's design.
Separate classes enable distinct behavior and attributes
for sellers and buyers.

The new classes adhere to the existing design patterns and principles
in the address book application. Tests cover various scenarios
to ensure the correctness of the implementations.
  • Loading branch information
felixchanyy committed Mar 18, 2024
1 parent e731de7 commit 32af1c7
Show file tree
Hide file tree
Showing 9 changed files with 446 additions and 0 deletions.
94 changes: 94 additions & 0 deletions src/main/java/seedu/address/logic/commands/AddBuyerCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_POSTALCODE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;

import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.person.Person;

/**
* Adds a buyer to the address book.
*/
public class AddBuyerCommand extends Command {

public static final String COMMAND_WORD = "addbuyer";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a buyer to the address book. "

Check warning on line 24 in src/main/java/seedu/address/logic/commands/AddBuyerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddBuyerCommand.java#L24

Added line #L24 was not covered by tests
+ "Parameters: "
+ PREFIX_NAME + "NAME "
+ PREFIX_PHONE + "PHONE "
+ PREFIX_EMAIL + "EMAIL "
+ PREFIX_ADDRESS + "ADDRESS "
+ PREFIX_POSTALCODE + "POSTAL CODE "
+ "[" + PREFIX_TAG + "TAG]...\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_NAME + "John Doe "
+ PREFIX_PHONE + "98765432 "
+ PREFIX_EMAIL + "johnd@example.com "
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 "
+ PREFIX_POSTALCODE + "578578 "
+ PREFIX_TAG + "friends "
+ PREFIX_TAG + "owesMoney";

public static final String MESSAGE_SUCCESS = "New buyer added: %1$s";
public static final String MESSAGE_DUPLICATE_PERSON = "This buyer already exists in the address book";

private final Person buyerToAdd;

/**
* Creates an AddBuyerCommand to add the specified buyer.
* @param person The buyer to be added.
*/
public AddBuyerCommand(Person person) {
requireNonNull(person);
buyerToAdd = person;
}

Check warning on line 53 in src/main/java/seedu/address/logic/commands/AddBuyerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddBuyerCommand.java#L50-L53

Added lines #L50 - L53 were not covered by tests
/**
* Executes the command and returns the result message.
*
* @param model {@code Model} which the command should operate on.
* @return feedback message of the operation result for display
* @throws CommandException If an error occurs during command execution.
*/
@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

Check warning on line 63 in src/main/java/seedu/address/logic/commands/AddBuyerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddBuyerCommand.java#L63

Added line #L63 was not covered by tests

if (model.hasPerson(buyerToAdd)) {
throw new CommandException(MESSAGE_DUPLICATE_PERSON);

Check warning on line 66 in src/main/java/seedu/address/logic/commands/AddBuyerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddBuyerCommand.java#L66

Added line #L66 was not covered by tests
}

model.addPerson(buyerToAdd);
return new CommandResult(String.format(MESSAGE_SUCCESS, Messages.format(buyerToAdd)));

Check warning on line 70 in src/main/java/seedu/address/logic/commands/AddBuyerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddBuyerCommand.java#L69-L70

Added lines #L69 - L70 were not covered by tests
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;

Check warning on line 76 in src/main/java/seedu/address/logic/commands/AddBuyerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddBuyerCommand.java#L76

Added line #L76 was not covered by tests
}

// instanceof handles nulls
if (!(other instanceof AddBuyerCommand)) {
return false;

Check warning on line 81 in src/main/java/seedu/address/logic/commands/AddBuyerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddBuyerCommand.java#L81

Added line #L81 was not covered by tests
}

AddBuyerCommand otherAddCommand = (AddBuyerCommand) other;
return buyerToAdd.equals(otherAddCommand.buyerToAdd);

Check warning on line 85 in src/main/java/seedu/address/logic/commands/AddBuyerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddBuyerCommand.java#L84-L85

Added lines #L84 - L85 were not covered by tests
}

@Override
public String toString() {
return new ToStringBuilder(this)
.add("buyerToAdd", buyerToAdd)
.toString();

Check warning on line 92 in src/main/java/seedu/address/logic/commands/AddBuyerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddBuyerCommand.java#L90-L92

Added lines #L90 - L92 were not covered by tests
}
}
94 changes: 94 additions & 0 deletions src/main/java/seedu/address/logic/commands/AddSellerCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_POSTALCODE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;

import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.person.Person;

/**
* Adds a seller to the address book.
*/
public class AddSellerCommand extends Command {

public static final String COMMAND_WORD = "addseller";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a seller to the address book. "

Check warning on line 24 in src/main/java/seedu/address/logic/commands/AddSellerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddSellerCommand.java#L24

Added line #L24 was not covered by tests
+ "Parameters: "
+ PREFIX_NAME + "NAME "
+ PREFIX_PHONE + "PHONE "
+ PREFIX_EMAIL + "EMAIL "
+ PREFIX_ADDRESS + "ADDRESS "
+ PREFIX_POSTALCODE + "POSTAL CODE "
+ "[" + PREFIX_TAG + "TAG]...\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_NAME + "John Doe "
+ PREFIX_PHONE + "98765432 "
+ PREFIX_EMAIL + "johnd@example.com "
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 "
+ PREFIX_POSTALCODE + "578578 "
+ PREFIX_TAG + "friends "
+ PREFIX_TAG + "owesMoney";

public static final String MESSAGE_SUCCESS = "New seller added: %1$s";
public static final String MESSAGE_DUPLICATE_PERSON = "This seller already exists in the address book";

private final Person sellerToAdd;

/**
* Creates an AddSellerCommand to add the specified seller.
* @param person The seller to be added.
*/
public AddSellerCommand(Person person) {
requireNonNull(person);
sellerToAdd = person;
}

Check warning on line 53 in src/main/java/seedu/address/logic/commands/AddSellerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddSellerCommand.java#L50-L53

Added lines #L50 - L53 were not covered by tests
/**
* Executes the command and returns the result message.
*
* @param model {@code Model} which the command should operate on.
* @return feedback message of the operation result for display
* @throws CommandException If an error occurs during command execution.
*/
@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

Check warning on line 63 in src/main/java/seedu/address/logic/commands/AddSellerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddSellerCommand.java#L63

Added line #L63 was not covered by tests

if (model.hasPerson(sellerToAdd)) {
throw new CommandException(MESSAGE_DUPLICATE_PERSON);

Check warning on line 66 in src/main/java/seedu/address/logic/commands/AddSellerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddSellerCommand.java#L66

Added line #L66 was not covered by tests
}

model.addPerson(sellerToAdd);
return new CommandResult(String.format(MESSAGE_SUCCESS, Messages.format(sellerToAdd)));

Check warning on line 70 in src/main/java/seedu/address/logic/commands/AddSellerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddSellerCommand.java#L69-L70

Added lines #L69 - L70 were not covered by tests
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;

Check warning on line 76 in src/main/java/seedu/address/logic/commands/AddSellerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddSellerCommand.java#L76

Added line #L76 was not covered by tests
}

// instanceof handles nulls
if (!(other instanceof AddSellerCommand)) {
return false;

Check warning on line 81 in src/main/java/seedu/address/logic/commands/AddSellerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddSellerCommand.java#L81

Added line #L81 was not covered by tests
}

AddSellerCommand otherAddCommand = (AddSellerCommand) other;
return sellerToAdd.equals(otherAddCommand.sellerToAdd);

Check warning on line 85 in src/main/java/seedu/address/logic/commands/AddSellerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddSellerCommand.java#L84-L85

Added lines #L84 - L85 were not covered by tests
}

@Override
public String toString() {
return new ToStringBuilder(this)
.add("sellerToAdd", sellerToAdd)
.toString();

Check warning on line 92 in src/main/java/seedu/address/logic/commands/AddSellerCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/AddSellerCommand.java#L90-L92

Added lines #L90 - L92 were not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_POSTALCODE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;

import java.util.Set;
import java.util.stream.Stream;

import seedu.address.logic.commands.AddBuyerCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.house.PostalCode;
import seedu.address.model.person.Address;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.person.Phone;
import seedu.address.model.tag.Tag;

/**
* Parses input arguments and creates a new AddCommand object
*/
public class AddBuyerCommandParser implements Parser<AddBuyerCommand> {

Check warning on line 27 in src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java#L27

Added line #L27 was not covered by tests

/**
* Parses the given {@code String} of arguments in the context of the AddCommand
* and returns an AddCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public AddBuyerCommand parse(String args) throws ParseException {
ArgumentMultimap argMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS,

Check warning on line 36 in src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java#L35-L36

Added lines #L35 - L36 were not covered by tests
PREFIX_POSTALCODE, PREFIX_TAG);

if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_POSTALCODE)
|| !argMultimap.getPreamble().isEmpty()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddBuyerCommand.MESSAGE_USAGE));

Check warning on line 41 in src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java#L41

Added line #L41 was not covered by tests
}

argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL,

Check warning on line 44 in src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java#L44

Added line #L44 was not covered by tests
PREFIX_ADDRESS, PREFIX_POSTALCODE);
Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get());
Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get());
Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get());
Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get());
PostalCode postalCode = ParserUtil.parsePostalCode(argMultimap.getValue(PREFIX_POSTALCODE).get());
Set<Tag> tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG));

Check warning on line 51 in src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java#L46-L51

Added lines #L46 - L51 were not covered by tests

Person person = new Person(name, phone, email, address, postalCode, tagList);

Check warning on line 53 in src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java#L53

Added line #L53 was not covered by tests

return new AddBuyerCommand(person);

Check warning on line 55 in src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java#L55

Added line #L55 was not covered by tests
}

/**
* Returns true if none of the prefixes contains empty {@code Optional} values in the given
* {@code ArgumentMultimap}.
*/
private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) {
return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent());

Check warning on line 63 in src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddBuyerCommandParser.java#L63

Added line #L63 was not covered by tests
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_POSTALCODE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;

import java.util.Set;
import java.util.stream.Stream;

import seedu.address.logic.commands.AddSellerCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.house.PostalCode;
import seedu.address.model.person.Address;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.person.Phone;
import seedu.address.model.tag.Tag;

/**
* Parses input arguments and creates a new AddCommand object
*/
public class AddSellerCommandParser implements Parser<AddSellerCommand> {

Check warning on line 27 in src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java#L27

Added line #L27 was not covered by tests

/**
* Parses the given {@code String} of arguments in the context of the AddCommand
* and returns an AddCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public AddSellerCommand parse(String args) throws ParseException {
ArgumentMultimap argMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS,

Check warning on line 36 in src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java#L35-L36

Added lines #L35 - L36 were not covered by tests
PREFIX_POSTALCODE, PREFIX_TAG);

if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_POSTALCODE)
|| !argMultimap.getPreamble().isEmpty()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddSellerCommand.MESSAGE_USAGE));

Check warning on line 41 in src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java#L41

Added line #L41 was not covered by tests
}

argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL,

Check warning on line 44 in src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java#L44

Added line #L44 was not covered by tests
PREFIX_ADDRESS, PREFIX_POSTALCODE);
Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get());
Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get());
Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get());
Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get());
PostalCode postalCode = ParserUtil.parsePostalCode(argMultimap.getValue(PREFIX_POSTALCODE).get());
Set<Tag> tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG));

Check warning on line 51 in src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java#L46-L51

Added lines #L46 - L51 were not covered by tests

Person person = new Person(name, phone, email, address, postalCode, tagList);

Check warning on line 53 in src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java#L53

Added line #L53 was not covered by tests

return new AddSellerCommand(person);

Check warning on line 55 in src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java#L55

Added line #L55 was not covered by tests
}

/**
* Returns true if none of the prefixes contains empty {@code Optional} values in the given
* {@code ArgumentMultimap}.
*/
private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) {
return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent());

Check warning on line 63 in src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddSellerCommandParser.java#L63

Added line #L63 was not covered by tests
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import java.util.regex.Pattern;

import seedu.address.commons.core.LogsCenter;
import seedu.address.logic.commands.AddBuyerCommand;
import seedu.address.logic.commands.AddCommand;
import seedu.address.logic.commands.AddSellerCommand;
import seedu.address.logic.commands.ClearCommand;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.DeleteCommand;
Expand Down Expand Up @@ -56,6 +58,12 @@ public Command parseCommand(String userInput) throws ParseException {
case AddCommand.COMMAND_WORD:
return new AddCommandParser().parse(arguments);

case AddSellerCommand.COMMAND_WORD:
return new AddSellerCommandParser().parse(arguments);

Check warning on line 62 in src/main/java/seedu/address/logic/parser/AddressBookParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddressBookParser.java#L62

Added line #L62 was not covered by tests

case AddBuyerCommand.COMMAND_WORD:
return new AddBuyerCommandParser().parse(arguments);

Check warning on line 65 in src/main/java/seedu/address/logic/parser/AddressBookParser.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/parser/AddressBookParser.java#L65

Added line #L65 was not covered by tests

case EditCommand.COMMAND_WORD:
return new EditCommandParser().parse(arguments);

Expand Down
26 changes: 26 additions & 0 deletions src/main/java/seedu/address/model/person/Buyer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package seedu.address.model.person;

import java.util.Set;

import seedu.address.model.house.PostalCode;
import seedu.address.model.tag.Tag;
/**
* Represents a buyer in the address book.
*/
public class Buyer extends Person {

/**
* Constructs a new Buyer instance.
*
* @param name The name of the buyer.
* @param phone The phone number of the buyer.
* @param email The email address of the buyer.
* @param address The address of the buyer.
* @param postalCode The postal code of the buyer's address.
* @param tags The tags associated with the buyer.
*/
public Buyer(Name name, Phone phone, Email email, Address address, PostalCode postalCode, Set<Tag> tags) {
super(name, phone, email, address, postalCode, tags);
}
}

Loading

0 comments on commit 32af1c7

Please sign in to comment.