Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2324S1#94 from jianrong7/chore/cicd-e…
Browse files Browse the repository at this point in the history
…rrors

Fix cicd pipeline errors
  • Loading branch information
jianrong7 authored Oct 26, 2023
2 parents f801887 + 4f6d3c6 commit 7e7766d
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 38 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@ shadowJar {
archiveFileName = 'addressbook.jar'
}

run {
enableAssertions = true
}

defaultTasks 'clean', 'test'
2 changes: 1 addition & 1 deletion src/test/java/seedu/address/logic/LogicManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void execute_invalidCommandFormat_throwsParseException() {

@Test
public void execute_commandExecutionError_throwsCommandException() {
String deleteCommand = "delete 9";
String deleteCommand = "delcust 9";
assertCommandException(deleteCommand, MESSAGE_INVALID_CUSTOMER_DISPLAYED_INDEX);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import seedu.address.logic.Messages;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.PropertyBook;
import seedu.address.model.UserPrefs;
import seedu.address.model.customer.Customer;
import seedu.address.testutil.CustomerBuilder;
Expand All @@ -32,7 +31,7 @@ public void setUp() {
public void execute_newCustomer_success() {
Customer validCustomer = new CustomerBuilder().build();

Model expectedModel = new ModelManager(model.getAddressBook(), new PropertyBook(), new UserPrefs());
Model expectedModel = new ModelManager(model.getAddressBook(), model.getPropertyBook(), new UserPrefs());
expectedModel.addCustomer(validCustomer);

assertCommandSuccess(new AddCustomerCommand(validCustomer), model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import seedu.address.logic.Messages;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.PropertyBook;
import seedu.address.model.UserPrefs;
import seedu.address.model.property.Property;
import seedu.address.testutil.PropertyBuilder;
Expand All @@ -32,7 +31,7 @@ public void setUp() {
public void execute_newProperty_success() {
Property validProperty = new PropertyBuilder().build();

Model expectedModel = new ModelManager(model.getAddressBook(), new PropertyBook(), new UserPrefs());
Model expectedModel = new ModelManager(model.getAddressBook(), model.getPropertyBook(), new UserPrefs());
expectedModel.addProperty(validProperty);

assertCommandSuccess(new AddPropertyCommand(validProperty), model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public class CommandPropertyTestUtil {
public static final String TAG_DESC_SQUARE = " " + PREFIX_TAG + VALID_TAG_SQUARE;
public static final String TAG_DESC_BIG = " " + PREFIX_TAG + VALID_TAG_BIG;

public static final String INVALID_NAME_DESC = " " + PREFIX_NAME + "James&"; // '&' not allowed in names
public static final String INVALID_NAME_DESC = " " + PREFIX_NAME + " "; // '&' not allowed in names
public static final String INVALID_PHONE_DESC = " " + PREFIX_PHONE + "911a"; // 'a' not allowed in phones
public static final String INVALID_ADDRESS_DESC = " " + PREFIX_ADDRESS + "SKYVIEW!"; // ! not allowed in address
public static final String INVALID_ADDRESS_DESC = " " + PREFIX_ADDRESS + " "; // ! not allowed in address
public static final String INVALID_PRICE_DESC = " " + PREFIX_PRICE; // empty string not allowed for PRICE
public static final String INVALID_TAG_DESC = " " + PREFIX_TAG + "hubby*"; // '*' not allowed in tags

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import seedu.address.logic.Messages;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.PropertyBook;
import seedu.address.model.UserPrefs;
import seedu.address.model.customer.Customer;
/**
Expand All @@ -36,7 +35,7 @@ public void execute_validIndexUnfilteredList_success() {
String expectedMessage = String.format(DeleteCustomerCommand.MESSAGE_DELETE_CUSTOMER_SUCCESS,
Messages.format(customerToDelete));

ModelManager expectedModel = new ModelManager(model.getAddressBook(), new PropertyBook(), new UserPrefs());
ModelManager expectedModel = new ModelManager(model.getAddressBook(), model.getPropertyBook(), new UserPrefs());
expectedModel.deleteCustomer(customerToDelete);

assertCommandSuccess(delcustCommand, model, expectedMessage, expectedModel);
Expand All @@ -60,7 +59,7 @@ public void execute_validIndexFilteredList_success() {
String expectedMessage = String.format(DeleteCustomerCommand.MESSAGE_DELETE_CUSTOMER_SUCCESS,
Messages.format(customerToDelete));

Model expectedModel = new ModelManager(model.getAddressBook(), new PropertyBook(), new UserPrefs());
Model expectedModel = new ModelManager(model.getAddressBook(), model.getPropertyBook(), new UserPrefs());
expectedModel.deleteCustomer(customerToDelete);
showNoCustomer(expectedModel);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import seedu.address.logic.Messages;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.PropertyBook;
import seedu.address.model.UserPrefs;
import seedu.address.model.property.Property;

Expand All @@ -37,7 +36,7 @@ public void execute_validIndexUnfilteredList_success() {
String expectedMessage = String.format(DeletePropertyCommand.MESSAGE_DELETE_PROPERTY_SUCCESS,
Messages.format(propertyToDelete));

ModelManager expectedModel = new ModelManager(model.getAddressBook(), new PropertyBook(), new UserPrefs());
ModelManager expectedModel = new ModelManager(model.getAddressBook(), model.getPropertyBook(), new UserPrefs());
expectedModel.deleteProperty(propertyToDelete);

assertCommandSuccess(deleteCommand, model, expectedMessage, expectedModel);
Expand All @@ -61,7 +60,7 @@ public void execute_validIndexFilteredList_success() {
String expectedMessage = String.format(DeletePropertyCommand.MESSAGE_DELETE_PROPERTY_SUCCESS,
Messages.format(propertyToDelete));

Model expectedModel = new ModelManager(model.getAddressBook(), new PropertyBook(), new UserPrefs());
Model expectedModel = new ModelManager(model.getAddressBook(), model.getPropertyBook(), new UserPrefs());
expectedModel.deleteProperty(propertyToDelete);
showNoProperty(expectedModel);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void execute_allFieldsSpecifiedUnfilteredList_success() {
Messages.format(editedCustomer));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
new PropertyBook(), new UserPrefs());
model.getPropertyBook(), new UserPrefs());
expectedModel.setCustomer(model.getFilteredCustomerList().get(0), editedCustomer);

assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
Expand All @@ -70,7 +70,7 @@ public void execute_someFieldsSpecifiedUnfilteredList_success() {
Messages.format(editedCustomer));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
new PropertyBook(), new UserPrefs());
new PropertyBook(model.getPropertyBook()), new UserPrefs());
expectedModel.setCustomer(lastCustomer, editedCustomer);

assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
Expand All @@ -85,7 +85,7 @@ public void execute_noFieldSpecifiedUnfilteredList_success() {
Messages.format(editedCustomer));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
new PropertyBook(), new UserPrefs());
new PropertyBook(model.getPropertyBook()), new UserPrefs());

assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
}
Expand All @@ -103,7 +103,7 @@ public void execute_filteredList_success() {
Messages.format(editedCustomer));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
new PropertyBook(), new UserPrefs());
new PropertyBook(model.getPropertyBook()), new UserPrefs());
expectedModel.setCustomer(model.getFilteredCustomerList().get(0), editedCustomer);

assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void execute_allFieldsSpecifiedUnfilteredList_success() {
Messages.format(editedProperty));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
new PropertyBook(), new UserPrefs());
new PropertyBook(model.getPropertyBook()), new UserPrefs());
expectedModel.setProperty(model.getFilteredPropertyList().get(0), editedProperty);

assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
Expand All @@ -71,7 +71,7 @@ public void execute_someFieldsSpecifiedUnfilteredList_success() {
Messages.format(editedProperty));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
new PropertyBook(), new UserPrefs());
new PropertyBook(model.getPropertyBook()), new UserPrefs());
expectedModel.setProperty(lastProperty, editedProperty);

assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
Expand All @@ -86,7 +86,7 @@ public void execute_noFieldSpecifiedUnfilteredList_success() {
Messages.format(editedProperty));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
new PropertyBook(), new UserPrefs());
new PropertyBook(model.getPropertyBook()), new UserPrefs());

assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
}
Expand All @@ -104,7 +104,7 @@ public void execute_filteredList_success() {
Messages.format(editedProperty));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()),
new PropertyBook(), new UserPrefs());
new PropertyBook(model.getPropertyBook()), new UserPrefs());
expectedModel.setProperty(model.getFilteredPropertyList().get(0), editedProperty);

assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.PropertyBook;
import seedu.address.model.UserPrefs;

/**
Expand All @@ -25,7 +24,7 @@ public class ListCustomerCommandTest {
@BeforeEach
public void setUp() {
model = new ModelManager(getTypicalAddressBook(), getTypicalPropertyBook(), new UserPrefs());
expectedModel = new ModelManager(model.getAddressBook(), new PropertyBook(), new UserPrefs());
expectedModel = new ModelManager(model.getAddressBook(), model.getPropertyBook(), new UserPrefs());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package seedu.address.logic.commands;

import static seedu.address.logic.commands.CommandPropertyTestUtil.showPropertyAtIndex;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.logic.commands.CommandTestUtil.showCustomerAtIndex;
import static seedu.address.testutil.TypicalCustomers.getTypicalAddressBook;
import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_CUSTOMER;
import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_PROPERTY;
import static seedu.address.testutil.TypicalProperties.getTypicalPropertyBook;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.PropertyBook;
import seedu.address.model.UserPrefs;

/**
Expand All @@ -23,8 +23,8 @@ public class ListPropertyCommandTest {

@BeforeEach
public void setUp() {
model = new ModelManager(getTypicalAddressBook(), new PropertyBook(), new UserPrefs());
expectedModel = new ModelManager(model.getAddressBook(), new PropertyBook(), new UserPrefs());
model = new ModelManager(getTypicalAddressBook(), getTypicalPropertyBook(), new UserPrefs());
expectedModel = new ModelManager(model.getAddressBook(), model.getPropertyBook(), new UserPrefs());
}

@Test
Expand All @@ -34,7 +34,7 @@ public void execute_listIsNotFiltered_showsSameList() {

@Test
public void execute_listIsFiltered_showsEverything() {
showCustomerAtIndex(model, INDEX_FIRST_CUSTOMER);
showPropertyAtIndex(model, INDEX_FIRST_PROPERTY);
assertCommandSuccess(new ListPropertyCommand(), model, ListPropertyCommand.MESSAGE_SUCCESS, expectedModel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void parseCommand_addcust() throws Exception {
public void parseCommand_addprop() throws Exception {
Property property = new PropertyBuilder().build();
AddPropertyCommand command = (AddPropertyCommand) parser.parseCommand(PropertyUtil.getAddCommand(property));
System.out.println(command);
assertEquals(new AddPropertyCommand(property), command);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void test_nameContainsKeywords_returnsTrue() {
// One keyword
PropNameContainsKeywordsPredicate predicate =
new PropNameContainsKeywordsPredicate(Collections.singletonList("Aquavista"));
assertTrue(predicate.test(new PropertyBuilder().withName(" Skyview").build()));
assertTrue(predicate.test(new PropertyBuilder().withName("Aquavista Skyview").build()));

// Multiple keywords
predicate = new PropNameContainsKeywordsPredicate(Arrays.asList("Aquavista", "Skyview"));
Expand All @@ -73,8 +73,7 @@ public void test_nameDoesNotContainKeywords_returnsFalse() {
assertFalse(predicate.test(new PropertyBuilder().withName("Aquavista Skyview").build()));

// Keywords match phone, address and price, but does not match name
predicate = new PropNameContainsKeywordsPredicate(Arrays.asList("12345", "123 Orchid Lane, Singapore 456789",
"Main", "Street"));
predicate = new PropNameContainsKeywordsPredicate(Arrays.asList("Horizonview", "Main", "Street"));
assertFalse(predicate.test(new PropertyBuilder().withName("Aquavista").withPhone("12345")
.withAddress("123 Orchid Lane, Singapore 456789").withPrice("123456").build()));
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/seedu/address/model/property/PropNameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public void isValidPropName() {
// invalid name
assertFalse(PropName.isValidName("")); // empty string
assertFalse(PropName.isValidName(" ")); // spaces only
assertFalse(PropName.isValidName("^")); // only non-alphanumeric characters
assertFalse(PropName.isValidName("skyview*")); // contains non-alphanumeric characters

// valid name
assertTrue(PropName.isValidName("^")); // only non-alphanumeric characters
assertTrue(PropName.isValidName("skyview*")); // contains non-alphanumeric characters
assertTrue(PropName.isValidName("skyview")); // alphabets only
assertTrue(PropName.isValidName("12345")); // numbers only
assertTrue(PropName.isValidName("skyview 2")); // alphanumeric characters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void equals() {
@Test
public void toStringMethod() {
String expected = Property.class.getCanonicalName() + "{name=" + AQUAVISTA.getName()
+ ", phone=" + AQUAVISTA.getPhone() + ", address=" + AQUAVISTA.getAddress()
+ ", address=" + AQUAVISTA.getAddress() + ", phone=" + AQUAVISTA.getPhone()
+ ", price=" + AQUAVISTA.getPrice() + ", tags=" + AQUAVISTA.getTags() + "}";
assertEquals(expected, AQUAVISTA.toString());
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/seedu/address/testutil/TypicalProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ public class TypicalProperties {
public static final Property LUXELOFT = new PropertyBuilder().withName("Luxeloft").withPhone("87652533")
.withAddress("234 Amber Crescent, Singapore 567890").withPrice("10000").withTags("garage").build();
public static final Property RIVERIA = new PropertyBuilder().withName("Riveria").withPhone("9482224")
.withAddress(" 567 Maple Lane, Singapore 109876").withPrice("4000000").build();
.withAddress("567 Maple Lane, Singapore 109876").withPrice("4000000").build();
public static final Property AZURE = new PropertyBuilder().withName("Azure").withPhone("9482427")
.withAddress("101 Radiant Lane, Singapore 123456").withPrice("874000").build();
public static final Property TRANQUILIS = new PropertyBuilder().withName("Tranquilis").withPhone("9482442")
.withAddress(" 202 Shoreline Street, Singapore 654321").withPrice("321950").build();
.withAddress("202 Shoreline Street, Singapore 654321").withPrice("321950").build();

// Manually added
public static final Property ASCEND = new PropertyBuilder().withName("Ascend").withPhone("8482424")
.withAddress("909 Skyline Boulevard, Singapore 789123").withPrice("4321000").build();
public static final Property SPECTRA = new PropertyBuilder().withName("Spectra").withPhone("8482131")
.withAddress(" 808 Colorful Street, Singapore 456012").withPrice("500000").build();
.withAddress("808 Colorful Street, Singapore 456012").withPrice("500000").build();

// Manually added - Customer's details found in {@code CommandTestUtil}
public static final Property AQUAVIEW = new PropertyBuilder().withName(VALID_NAME_AQUAVIEW)
Expand Down

0 comments on commit 7e7766d

Please sign in to comment.