Skip to content

Commit

Permalink
Move duplicate message to PublicAddressComposition
Browse files Browse the repository at this point in the history
  • Loading branch information
chongtzezhao committed Nov 10, 2024
1 parent 3b216b9 commit 6195d17
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_PUBLIC_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PUBLIC_ADDRESS_LABEL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PUBLIC_ADDRESS_NETWORK;
import static seedu.address.model.addresses.PublicAddressesComposition.MESSAGE_DUPLICATE_PUBLIC_ADDRESS;

import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -37,7 +38,6 @@ public class AddPublicAddressCommand extends AbstractEditCommand {
+ "wallet1 " + PREFIX_PUBLIC_ADDRESS + "1a1zp1ep5qgefi2dmptftl5slmv7divfna";

public static final String MESSAGE_ADDPA_SUCCESS = "Added Person's Public Address: %1$s";
public static final String MESSAGE_DUPLICATE_PUBLIC_ADDRESS = "Invalid: duplicate label or public address\n%1$s\n";

private EditPersonDescriptor editPersonDescriptor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class PublicAddressesComposition {
public static final String MESSAGE_DUPLICATE_LABEL =
"Label %1$s under the network %2$s already exists.";

public static final String MESSAGE_DUPLICATE_PUBLIC_ADDRESS = "Invalid: duplicate label or public address\n%1$s\n";

private final Map<Network, Set<PublicAddress>> publicAddresses;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.model.addresses.PublicAddressesComposition.MESSAGE_DUPLICATE_PUBLIC_ADDRESS;
import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_PERSON;
import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND_PERSON;
import static seedu.address.testutil.TypicalPersons.getTypicalAddressBook;
Expand Down Expand Up @@ -98,7 +99,7 @@ public void execute_duplicateAddressLabel_throwsCommandException() {
}

// Expected message
String expectedMessage = String.format(AddPublicAddressCommand.MESSAGE_DUPLICATE_PUBLIC_ADDRESS,
String expectedMessage = String.format(MESSAGE_DUPLICATE_PUBLIC_ADDRESS,
String.format(
PublicAddressesComposition.MESSAGE_DUPLICATE_LABEL,
duplicateLabel,
Expand Down Expand Up @@ -142,7 +143,7 @@ public void execute_duplicateAddress_throwsCommandException() {
}

// Expected message
String expectedMessage = String.format(AddPublicAddressCommand.MESSAGE_DUPLICATE_PUBLIC_ADDRESS,
String expectedMessage = String.format(MESSAGE_DUPLICATE_PUBLIC_ADDRESS,
duplicateAddressString.toLowerCase()
);

Expand Down

0 comments on commit 6195d17

Please sign in to comment.