tags) {
this.name = name;
this.positionPlayed = positionPlayed;
this.age = age;
@@ -52,8 +53,10 @@ public Player(Name name, PositionPlayed positionPlayed, Age age, Salary salary,
* Copy constructor.
*/
public Player(ReadOnlyPlayer source) {
- this(source.getName(), source.getPositionPlayed(), source.getAge(), source.getSalary(),source.getGoalsScored(),source.getGoalsAssisted(),
- source.getTeam(),source.getCountry(),source.getJerseyNumber(),source.getAppearance(),source.getHealthStatus(), source.getTags());
+ this(source.getName(), source.getPositionPlayed(), source.getAge(), source.getSalary(),
+ source.getGoalsScored(), source.getGoalsAssisted(), source.getTeam(),
+ source.getCountry(), source.getJerseyNumber(), source.getAppearance(),
+ source.getHealthStatus(), source.getTags());
}
/**
diff --git a/src/seedu/addressbook/data/player/ReadOnlyPlayer.java b/src/seedu/addressbook/data/player/ReadOnlyPlayer.java
index 55abadf40..9fe452ade 100644
--- a/src/seedu/addressbook/data/player/ReadOnlyPlayer.java
+++ b/src/seedu/addressbook/data/player/ReadOnlyPlayer.java
@@ -57,42 +57,29 @@ default String getAsTextShowAll() {
builder.append("\n")
.append("Name: ")
- .append(getName()) // name
-
+ .append(getName()) // name
.append(" | Position Played: ") // position
.append(getPositionPlayed())
-
.append(" | Age: ") // age
.append(getAge())
-
.append(" | Salary: ") //salary
.append(getSalary())
-
.append("\n")
-
.append("Goals scored: ") // goals scored
.append(getGoalsScored())
-
.append(" | Goals assisted: ") // goals assisted
.append(getGoalsAssisted())
-
.append(" | Team: ") // Team
.append(getTeam())
-
.append(" | Country: ") // country
.append(getCountry())
-
.append("\n")
-
.append("Jersey Number: ") //Jersey Number
.append(getJerseyNumber())
-
.append(" | Appearance: ") // Appearance
.append(getAppearance())
-
.append(" | HealthStatus: ") //Health Status
.append(getHealthStatus())
-
.append(" | Tags: ");
for (Tag tag : getTags()) {
builder.append(tag);
diff --git a/src/seedu/addressbook/data/player/Salary.java b/src/seedu/addressbook/data/player/Salary.java
index 477737a00..6c6bcf841 100644
--- a/src/seedu/addressbook/data/player/Salary.java
+++ b/src/seedu/addressbook/data/player/Salary.java
@@ -8,56 +8,56 @@
*/
public class Salary {
- public static final String EXAMPLE = "100000";
- public static final String MESSAGE_Salary_CONSTRAINTS = "Player salary should be a positive number";
- public static final String SALARY_VALIDATION_REGEX = "\\d+";
-
- public final String value;
-
-
- /**
- * Validates given player salary.
- *
- * @throws IllegalValueException if given salary string is invalid.
- */
- public Salary(String salary) throws IllegalValueException {
- salary = salary.trim();
- if (!isValidSalary(salary)) {
- throw new IllegalValueException(MESSAGE_Salary_CONSTRAINTS);
- }
- this.value = salary;
+ public static final String EXAMPLE = "100000";
+ public static final String MESSAGE_Salary_CONSTRAINTS = "Player salary should be a positive number";
+ public static final String SALARY_VALIDATION_REGEX = "\\d+";
+
+ public final String value;
+
+
+ /**
+ * Validates given player salary.
+ *
+ * @throws IllegalValueException if given salary string is invalid.
+ */
+ public Salary(String salary) throws IllegalValueException {
+ salary = salary.trim();
+ if (!isValidSalary(salary)) {
+ throw new IllegalValueException(MESSAGE_Salary_CONSTRAINTS);
}
+ this.value = salary;
+ }
- /**
- * Checks if a given string is a valid player salary.
- */
- public static boolean isValidSalary(String test) {
- try {
- int i = Integer.parseInt(test);
- return (test.matches(SALARY_VALIDATION_REGEX) && i>=0);
- } catch(NumberFormatException nfe){
- return false;
- }
+ /**
+ * Checks if a given string is a valid player salary.
+ */
+ public static boolean isValidSalary(String test) {
+ try {
+ int i = Integer.parseInt(test);
+ return (test.matches(SALARY_VALIDATION_REGEX) && i >= 0);
+ } catch (NumberFormatException nfe) {
+ return false;
}
+ }
- @Override
- public String toString() {
- return value;
- }
+ @Override
+ public String toString() {
+ return value;
+ }
- @Override
- public boolean equals(Object other) {
- return other == this // short circuit if same object
- || (other instanceof Salary // instanceof handles nulls
- && this.value.equals(((Salary) other).value)); // state check
- }
+ @Override
+ public boolean equals(Object other) {
+ return other == this // short circuit if same object
+ || (other instanceof Salary // instanceof handles nulls
+ && this.value.equals(((Salary) other).value)); // state check
+ }
- @Override
- public int hashCode() {
- return value.hashCode();
- }
+ @Override
+ public int hashCode() {
+ return value.hashCode();
+ }
- }
+}
diff --git a/src/seedu/addressbook/parser/Parser.java b/src/seedu/addressbook/parser/Parser.java
index c9d727776..e65e2add3 100644
--- a/src/seedu/addressbook/parser/Parser.java
+++ b/src/seedu/addressbook/parser/Parser.java
@@ -100,75 +100,75 @@ public Command parseCommand(String userInput) {
final String commandWord = matcher.group("commandWord");
final String arguments = matcher.group("arguments");
switch (commandWord) {
- case AddCommand.COMMAND_WORD:
- return prepareAddPlayer(arguments);
+ case AddCommand.COMMAND_WORD:
+ return prepareAddPlayer(arguments);
- case AddFastCommand.COMMAND_WORD:
- return prepareAddFastPlayer(arguments);
+ case AddFastCommand.COMMAND_WORD:
+ return prepareAddFastPlayer(arguments);
- case AddTeam.COMMAND_WORD:
- return addTeam(arguments);
+ case AddTeam.COMMAND_WORD:
+ return addTeam(arguments);
- case DeleteCommand.COMMAND_WORD:
- return prepareDeletePlayer(arguments);
+ case DeleteCommand.COMMAND_WORD:
+ return prepareDeletePlayer(arguments);
- case DeleteTeam.COMMAND_WORD:
- return delTeam(arguments);
+ case DeleteTeam.COMMAND_WORD:
+ return delTeam(arguments);
- case ClearCommand.COMMAND_WORD:
- return new ClearCommand();
+ case ClearCommand.COMMAND_WORD:
+ return new ClearCommand();
- case ClearTeam.COMMAND_WORD:
- return new ClearTeam();
+ case ClearTeam.COMMAND_WORD:
+ return new ClearTeam();
- case FindCommand.COMMAND_WORD:
- return prepareFindPerson(arguments);
+ case FindCommand.COMMAND_WORD:
+ return prepareFindPerson(arguments);
- case FindTeam.COMMAND_WORD:
- return prepareFindTeam(arguments);
+ case FindTeam.COMMAND_WORD:
+ return prepareFindTeam(arguments);
- case FinanceCommand.COMMAND_WORD:
- return prepareFinance(arguments);
+ case FinanceCommand.COMMAND_WORD:
+ return prepareFinance(arguments);
- case ListCommand.COMMAND_WORD:
- return new ListCommand();
+ case ListCommand.COMMAND_WORD:
+ return new ListCommand();
- case AddMatchCommand.COMMAND_WORD:
- return prepareAddMatch(arguments);
+ case AddMatchCommand.COMMAND_WORD:
+ return prepareAddMatch(arguments);
- case DeleteMatchCommand.COMMAND_WORD:
- return prepareDeleteMatch(arguments);
+ case DeleteMatchCommand.COMMAND_WORD:
+ return prepareDeleteMatch(arguments);
- case ClearMatchCommand.COMMAND_WORD:
- return new ClearMatchCommand();
+ case ClearMatchCommand.COMMAND_WORD:
+ return new ClearMatchCommand();
- case FindMatchCommand.COMMAND_WORD:
- return prepareFindMatch(arguments);
+ case FindMatchCommand.COMMAND_WORD:
+ return prepareFindMatch(arguments);
- case ListMatchCommand.COMMAND_WORD:
- return new ListMatchCommand();
+ case ListMatchCommand.COMMAND_WORD:
+ return new ListMatchCommand();
- case ListTeam.COMMAND_WORD:
- return new ListTeam();
+ case ListTeam.COMMAND_WORD:
+ return new ListTeam();
- case ListFinanceCommand.COMMAND_WORD:
- return new ListFinanceCommand();
+ case ListFinanceCommand.COMMAND_WORD:
+ return new ListFinanceCommand();
- case EditTeam.COMMAND_WORD:
- return prepareEditTeam(arguments);
+ case EditTeam.COMMAND_WORD:
+ return prepareEditTeam(arguments);
- case SortCommand.COMMAND_WORD:
- return new SortCommand();
+ case SortCommand.COMMAND_WORD:
+ return new SortCommand();
- case ViewAllCommand.COMMAND_WORD:
- return prepareViewAll(arguments);
+ case ViewAllCommand.COMMAND_WORD:
+ return prepareViewAll(arguments);
- case ExitCommand.COMMAND_WORD:
- return new ExitCommand();
+ case ExitCommand.COMMAND_WORD:
+ return new ExitCommand();
- case HelpCommand.COMMAND_WORD: // Fallthrough
- default:
- return new HelpCommand();
+ case HelpCommand.COMMAND_WORD: // Fallthrough
+ default:
+ return new HelpCommand();
}
}
@@ -400,7 +400,6 @@ private Command prepareEditTeam(String args) {
}
-
/**
* Parses arguments in the context of the view all command.
*
diff --git a/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java b/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java
index 44cfd899d..707f2d913 100644
--- a/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java
+++ b/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java
@@ -55,7 +55,8 @@ public class AdaptedPlayer {
/**
* No-arg constructor for JAXB use.
*/
- public AdaptedPlayer() {}
+ public AdaptedPlayer() {
+ }
/**
@@ -84,7 +85,7 @@ public AdaptedPlayer(ReadOnlyPlayer source) {
/**
* Returns true if any required field is missing.
- *
+ *
* JAXB does not enforce (required = true) without a given XML schema.
* Since we do most of our validation using the data class constructors, the only extra logic we need
* is to ensure that every xml element in the document is present. JAXB sets missing elements as null,
@@ -98,7 +99,8 @@ public boolean isAnyRequiredFieldMissing() {
}
}
// second call only happens if phone/email/address are all not null
- return Utils.isAnyNull(name, position, age,salary,goalsScored,goalsAssisted,team,country,jerseyNumber,appearance,healthStatus);
+ return Utils.isAnyNull(name, position, age, salary, goalsScored, goalsAssisted, team, country, jerseyNumber,
+ appearance, healthStatus);
}
/**
@@ -123,6 +125,7 @@ public Player toModelType() throws IllegalValueException {
final Appearance appearance = new Appearance(this.appearance);
final HealthStatus healthStatus = new HealthStatus(this.healthStatus);
- return new Player(name, positionPlayed,age,salary,goalsScored,goalsAssisted,team,country,jerseyNumber,appearance,healthStatus, tags);
+ return new Player(name, positionPlayed, age, salary, goalsScored, goalsAssisted,
+ team, country, jerseyNumber, appearance, healthStatus, tags);
}
}
From 682aa41091eb84c2097d4902d684d519a6d9dc2f Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 00:00:17 +0800
Subject: [PATCH 07/19] edit to fit checkstyle attempt 2
---
.../commands/player/AddFastCommand.java | 3 +-
src/seedu/addressbook/common/Messages.java | 2 +-
src/seedu/addressbook/data/player/Age.java | 2 +-
.../data/player/GoalsAssisted.java | 2 +-
.../addressbook/data/player/GoalsScored.java | 2 +-
src/seedu/addressbook/data/player/Player.java | 13 +++---
.../data/player/ReadOnlyPlayer.java | 45 ++++++++-----------
src/seedu/addressbook/data/player/Salary.java | 4 +-
src/seedu/addressbook/parser/Parser.java | 12 ++---
.../seedu/addressbook/logic/LogicTest.java | 2 +-
10 files changed, 41 insertions(+), 46 deletions(-)
diff --git a/src/seedu/addressbook/commands/player/AddFastCommand.java b/src/seedu/addressbook/commands/player/AddFastCommand.java
index 666f29891..e918e8c77 100644
--- a/src/seedu/addressbook/commands/player/AddFastCommand.java
+++ b/src/seedu/addressbook/commands/player/AddFastCommand.java
@@ -42,7 +42,8 @@ public class AddFastCommand extends Command {
*
* @throws IllegalValueException if any of the raw values are invalid
*/
- public AddFastCommand(String name, String position, String age, String salary, String team, String country, String jerseyNumber,
+ public AddFastCommand(String name, String position, String age, String salary,
+ String team, String country, String jerseyNumber,
Set tags) throws IllegalValueException {
final Set tagSet = new HashSet<>();
for (String tagName : tags) {
diff --git a/src/seedu/addressbook/common/Messages.java b/src/seedu/addressbook/common/Messages.java
index cf74054cc..db23d72f2 100644
--- a/src/seedu/addressbook/common/Messages.java
+++ b/src/seedu/addressbook/common/Messages.java
@@ -10,7 +10,7 @@ public class Messages {
public static final String MESSAGE_PLAYER_NOT_IN_LEAGUE = "Player could not be found in the league record";
public static final String MESSAGE_PLAYERS_LISTED_OVERVIEW = "%1$d players listed!";
public static final String MESSAGE_INVALID_MATCH_DISPLAYED_INDEX = "The match index provided is invalid";
- public static final String MESSAGE_MATCH_NOT_IN_LEAGUE_TRACKER = "match could not be found in league tracker's record";
+ public static final String MESSAGE_MATCH_NOT_IN_LEAGUE_TRACKER = "match could not be found";
public static final String MESSAGE_MATCHES_LISTED_OVERVIEW = "%1$d matches listed!";
public static final String MESSAGE_INVALID_TEAM_DISPLAYED_INDEX = "The team index provided is invalid";
public static final String MESSAGE_TEAM_NOT_IN_LEAGUE_TRACKER = "team could not be found in league tracker";
diff --git a/src/seedu/addressbook/data/player/Age.java b/src/seedu/addressbook/data/player/Age.java
index cf5c4591d..eb1910153 100644
--- a/src/seedu/addressbook/data/player/Age.java
+++ b/src/seedu/addressbook/data/player/Age.java
@@ -37,7 +37,7 @@ public static boolean isValidAge(String test) {
try {
int temp = Integer.parseInt(test);
return (test.matches(AGE_VALIDATION_REGEX) && temp > 0 && temp < 100);
- } catch (NumberFormatException nfe){
+ } catch (NumberFormatException nfe) {
return false;
}
}
diff --git a/src/seedu/addressbook/data/player/GoalsAssisted.java b/src/seedu/addressbook/data/player/GoalsAssisted.java
index 2a7a0f37a..5411a11c2 100644
--- a/src/seedu/addressbook/data/player/GoalsAssisted.java
+++ b/src/seedu/addressbook/data/player/GoalsAssisted.java
@@ -35,7 +35,7 @@ public static boolean isValidGa(String test) {
try {
int temp = Integer.parseInt(test);
return (test.matches(GA_VALIDATION_REGEX) && temp >= 0);
- } catch (NumberFormatException nfe){
+ } catch (NumberFormatException nfe) {
return false;
}
}
diff --git a/src/seedu/addressbook/data/player/GoalsScored.java b/src/seedu/addressbook/data/player/GoalsScored.java
index 5bd844659..34d5398c6 100644
--- a/src/seedu/addressbook/data/player/GoalsScored.java
+++ b/src/seedu/addressbook/data/player/GoalsScored.java
@@ -33,7 +33,7 @@ public static boolean isValidGs(String test) {
try {
int temp = Integer.parseInt(test);
return (test.matches(GS_VALIDATION_REGEX) && temp >= 0);
- } catch (NumberFormatException nfe){
+ } catch (NumberFormatException nfe) {
return false;
}
diff --git a/src/seedu/addressbook/data/player/Player.java b/src/seedu/addressbook/data/player/Player.java
index db5f53024..634542230 100644
--- a/src/seedu/addressbook/data/player/Player.java
+++ b/src/seedu/addressbook/data/player/Player.java
@@ -61,13 +61,14 @@ public Player(ReadOnlyPlayer source) {
/**
* User Default Constructor
- * allow user to create a player with some attributes as default value
+ * allow user to create a player with some attributes as default value
*/
- public Player (Name name, PositionPlayed positionPlayed, Age age, Salary salary, Team team,
- Country country, JerseyNumber jerseyNumber, Set tags) throws IllegalValueException {
- this(name,positionPlayed,age,salary,new GoalsScored("0"),new GoalsAssisted("0"),team,country,jerseyNumber,new Appearance("0"),
- new HealthStatus("Healthy"),tags);
+ public Player(Name name, PositionPlayed positionPlayed, Age age, Salary salary, Team team,
+ Country country, JerseyNumber jerseyNumber, Set tags) throws IllegalValueException {
+ this(name, positionPlayed, age, salary, new GoalsScored("0"),
+ new GoalsAssisted("0"), team, country, jerseyNumber, new Appearance("0"),
+ new HealthStatus("Healthy"), tags);
}
@@ -149,7 +150,7 @@ public boolean equals(Object other) {
@Override
public int hashCode() {
// use this method for custom fields hashing instead of implementing your own
- return Objects.hash(name, positionPlayed, age,salary, goalsScored, goalsAssisted, team, country, jerseyNumber,
+ return Objects.hash(name, positionPlayed, age, salary, goalsScored, goalsAssisted, team, country, jerseyNumber,
appearance, healthStatus, tags);
}
diff --git a/src/seedu/addressbook/data/player/ReadOnlyPlayer.java b/src/seedu/addressbook/data/player/ReadOnlyPlayer.java
index 9fe452ade..b97359f93 100644
--- a/src/seedu/addressbook/data/player/ReadOnlyPlayer.java
+++ b/src/seedu/addressbook/data/player/ReadOnlyPlayer.java
@@ -11,15 +11,25 @@
public interface ReadOnlyPlayer {
Name getName();
+
PositionPlayed getPositionPlayed();
+
Salary getSalary();
+
Age getAge();
+
GoalsScored getGoalsScored();
+
GoalsAssisted getGoalsAssisted();
+
Team getTeam();
+
Country getCountry();
+
JerseyNumber getJerseyNumber();
+
Appearance getAppearance();
+
HealthStatus getHealthStatus();
/**
@@ -55,32 +65,15 @@ default boolean isSameStateAs(ReadOnlyPlayer other) {
default String getAsTextShowAll() {
final StringBuilder builder = new StringBuilder();
- builder.append("\n")
- .append("Name: ")
- .append(getName()) // name
- .append(" | Position Played: ") // position
- .append(getPositionPlayed())
- .append(" | Age: ") // age
- .append(getAge())
- .append(" | Salary: ") //salary
- .append(getSalary())
- .append("\n")
- .append("Goals scored: ") // goals scored
- .append(getGoalsScored())
- .append(" | Goals assisted: ") // goals assisted
- .append(getGoalsAssisted())
- .append(" | Team: ") // Team
- .append(getTeam())
- .append(" | Country: ") // country
- .append(getCountry())
- .append("\n")
- .append("Jersey Number: ") //Jersey Number
- .append(getJerseyNumber())
- .append(" | Appearance: ") // Appearance
- .append(getAppearance())
- .append(" | HealthStatus: ") //Health Status
- .append(getHealthStatus())
- .append(" | Tags: ");
+ builder.append("\n").append("Name: ").append(getName()).append(" | Position Played: ")
+ .append(getPositionPlayed()).append(" | Age: ").append(getAge()).append(" | Salary: ")
+ .append(getSalary()).append("\n").append("Goals scored: ").append(getGoalsScored())
+ .append(" | Goals assisted: ").append(getGoalsAssisted()).append(" | Team: ")
+ .append(getTeam()).append(" | Country: ").append(getCountry())
+ .append("\n").append("Jersey Number: ").append(getJerseyNumber())
+ .append(" | Appearance: ").append(getAppearance()).append(" | HealthStatus: ")
+ .append(getHealthStatus()).append(" | Tags: ");
+
for (Tag tag : getTags()) {
builder.append(tag);
}
diff --git a/src/seedu/addressbook/data/player/Salary.java b/src/seedu/addressbook/data/player/Salary.java
index 6c6bcf841..c62a8a62c 100644
--- a/src/seedu/addressbook/data/player/Salary.java
+++ b/src/seedu/addressbook/data/player/Salary.java
@@ -9,7 +9,7 @@
public class Salary {
public static final String EXAMPLE = "100000";
- public static final String MESSAGE_Salary_CONSTRAINTS = "Player salary should be a positive number";
+ public static final String MESSAGE_SALARY_CONSTRAINTS = "Player salary should be a positive number";
public static final String SALARY_VALIDATION_REGEX = "\\d+";
public final String value;
@@ -23,7 +23,7 @@ public class Salary {
public Salary(String salary) throws IllegalValueException {
salary = salary.trim();
if (!isValidSalary(salary)) {
- throw new IllegalValueException(MESSAGE_Salary_CONSTRAINTS);
+ throw new IllegalValueException(MESSAGE_SALARY_CONSTRAINTS);
}
this.value = salary;
}
diff --git a/src/seedu/addressbook/parser/Parser.java b/src/seedu/addressbook/parser/Parser.java
index e65e2add3..534f25af3 100644
--- a/src/seedu/addressbook/parser/Parser.java
+++ b/src/seedu/addressbook/parser/Parser.java
@@ -279,12 +279,12 @@ private Command prepareAddMatch(String args) {
}
}
-// /**
-// * Checks whether the private prefix of a contact detail in the add command's arguments string is present.
-// */
-// private static boolean isPrivatePrefixPresent(String matchedPrefix) {
-// return matchedPrefix.equals("p");
-// }
+ // /**
+ // * Checks whether the private prefix of a contact detail in the add command's arguments string is present.
+ // */
+ // private static boolean isPrivatePrefixPresent(String matchedPrefix) {
+ // return matchedPrefix.equals("p");
+ // }
/**
* Extracts the new player's tags from the add command's tag arguments string.
diff --git a/test/java/seedu/addressbook/logic/LogicTest.java b/test/java/seedu/addressbook/logic/LogicTest.java
index 2235b30a8..b7b73721b 100644
--- a/test/java/seedu/addressbook/logic/LogicTest.java
+++ b/test/java/seedu/addressbook/logic/LogicTest.java
@@ -222,7 +222,7 @@ public void execute_add_invalidPlayerData() throws Exception {
// assertCommandBehavior(
// "addPlayer Valid Name p/Striker a/800 sal/20000 gs/0 ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy", Age.MESSAGE_AGE_CONSTRAINTS);
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/zero gs/0 ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy", Salary.MESSAGE_Salary_CONSTRAINTS);
+ "addPlayer Valid Name p/Striker a/30 sal/zero gs/0 ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy", Salary.MESSAGE_SALARY_CONSTRAINTS);
assertCommandBehavior(
"addPlayer Valid Name p/Striker a/30 sal/20000 gs/zero ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy", GoalsScored.MESSAGE_GS_CONSTRAINTS);
assertCommandBehavior(
From 79a795b743620c12af8cfd054d40a2ba94b66294 Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 00:18:21 +0800
Subject: [PATCH 08/19] edit to pass Travis attempt 3
---
src/seedu/addressbook/parser/Parser.java | 95 ++++++++++++------------
1 file changed, 48 insertions(+), 47 deletions(-)
diff --git a/src/seedu/addressbook/parser/Parser.java b/src/seedu/addressbook/parser/Parser.java
index 534f25af3..25a3bdee8 100644
--- a/src/seedu/addressbook/parser/Parser.java
+++ b/src/seedu/addressbook/parser/Parser.java
@@ -100,75 +100,76 @@ public Command parseCommand(String userInput) {
final String commandWord = matcher.group("commandWord");
final String arguments = matcher.group("arguments");
switch (commandWord) {
- case AddCommand.COMMAND_WORD:
- return prepareAddPlayer(arguments);
+ case AddCommand.COMMAND_WORD:
+ return prepareAddPlayer(arguments);
- case AddFastCommand.COMMAND_WORD:
- return prepareAddFastPlayer(arguments);
+ case AddFastCommand.COMMAND_WORD:
+ return prepareAddFastPlayer(arguments);
- case AddTeam.COMMAND_WORD:
- return addTeam(arguments);
+ case AddTeam.COMMAND_WORD:
+ return addTeam(arguments);
- case DeleteCommand.COMMAND_WORD:
- return prepareDeletePlayer(arguments);
+ case DeleteCommand.COMMAND_WORD:
+ return prepareDeletePlayer(arguments);
- case DeleteTeam.COMMAND_WORD:
- return delTeam(arguments);
+ case DeleteTeam.COMMAND_WORD:
+ return delTeam(arguments);
- case ClearCommand.COMMAND_WORD:
- return new ClearCommand();
+ case ClearCommand.COMMAND_WORD:
+ return new ClearCommand();
- case ClearTeam.COMMAND_WORD:
- return new ClearTeam();
+ case ClearTeam.COMMAND_WORD:
+ return new ClearTeam();
- case FindCommand.COMMAND_WORD:
- return prepareFindPerson(arguments);
+ case FindCommand.COMMAND_WORD:
+ return prepareFindPerson(arguments);
- case FindTeam.COMMAND_WORD:
- return prepareFindTeam(arguments);
+ case FindTeam.COMMAND_WORD:
+ return prepareFindTeam(arguments);
- case FinanceCommand.COMMAND_WORD:
- return prepareFinance(arguments);
+ case FinanceCommand.COMMAND_WORD:
+ return prepareFinance(arguments);
- case ListCommand.COMMAND_WORD:
- return new ListCommand();
+ case ListCommand.COMMAND_WORD:
+ return new ListCommand();
- case AddMatchCommand.COMMAND_WORD:
- return prepareAddMatch(arguments);
+ case AddMatchCommand.COMMAND_WORD:
+ return prepareAddMatch(arguments);
- case DeleteMatchCommand.COMMAND_WORD:
- return prepareDeleteMatch(arguments);
+ case DeleteMatchCommand.COMMAND_WORD:
+ return prepareDeleteMatch(arguments);
- case ClearMatchCommand.COMMAND_WORD:
- return new ClearMatchCommand();
+ case ClearMatchCommand.COMMAND_WORD:
+ return new ClearMatchCommand();
- case FindMatchCommand.COMMAND_WORD:
- return prepareFindMatch(arguments);
+ case FindMatchCommand.COMMAND_WORD:
+ return prepareFindMatch(arguments);
- case ListMatchCommand.COMMAND_WORD:
- return new ListMatchCommand();
+ case ListMatchCommand.COMMAND_WORD:
+ return new ListMatchCommand();
- case ListTeam.COMMAND_WORD:
- return new ListTeam();
+ case ListTeam.COMMAND_WORD:
+ return new ListTeam();
- case ListFinanceCommand.COMMAND_WORD:
- return new ListFinanceCommand();
+ case ListFinanceCommand.COMMAND_WORD:
+ return new ListFinanceCommand();
- case EditTeam.COMMAND_WORD:
- return prepareEditTeam(arguments);
+ case EditTeam.COMMAND_WORD:
+ return prepareEditTeam(arguments);
- case SortCommand.COMMAND_WORD:
- return new SortCommand();
+ case SortCommand.COMMAND_WORD:
+ return new SortCommand();
- case ViewAllCommand.COMMAND_WORD:
- return prepareViewAll(arguments);
+ case ViewAllCommand.COMMAND_WORD:
+ return prepareViewAll(arguments);
- case ExitCommand.COMMAND_WORD:
- return new ExitCommand();
+ case ExitCommand.COMMAND_WORD:
+ return new ExitCommand();
- case HelpCommand.COMMAND_WORD: // Fallthrough
- default:
- return new HelpCommand();
+ case HelpCommand.COMMAND_WORD: // Fallthrough
+
+ default:
+ return new HelpCommand();
}
}
From b9fb16a84269f10419019635d0fc8c88436526e9 Mon Sep 17 00:00:00 2001
From: warheade <35769004+warheade@users.noreply.github.com>
Date: Sat, 30 Mar 2019 00:26:07 +0800
Subject: [PATCH 09/19] Update Command.java
---
src/seedu/addressbook/commands/Command.java | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/seedu/addressbook/commands/Command.java b/src/seedu/addressbook/commands/Command.java
index a89fb9b8b..c1bc33d09 100644
--- a/src/seedu/addressbook/commands/Command.java
+++ b/src/seedu/addressbook/commands/Command.java
@@ -1,5 +1,9 @@
package seedu.addressbook.commands;
+import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;
+
+import java.util.List;
+
import seedu.addressbook.common.Messages;
import seedu.addressbook.data.AddressBook;
import seedu.addressbook.data.finance.ReadOnlyFinance;
@@ -7,13 +11,6 @@
import seedu.addressbook.data.player.ReadOnlyPlayer;
import seedu.addressbook.data.team.ReadOnlyTeam;
-import java.util.List;
-
-import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;
-
-
-
-
/**
* Represents an executable command.
*/
From 00ac69a2cb48fc29f8d8eb6da2226927d440b50b Mon Sep 17 00:00:00 2001
From: warheade <35769004+warheade@users.noreply.github.com>
Date: Sat, 30 Mar 2019 00:26:55 +0800
Subject: [PATCH 10/19] Update CommandResult.java
---
src/seedu/addressbook/commands/CommandResult.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/seedu/addressbook/commands/CommandResult.java b/src/seedu/addressbook/commands/CommandResult.java
index 084e943ed..f96342341 100644
--- a/src/seedu/addressbook/commands/CommandResult.java
+++ b/src/seedu/addressbook/commands/CommandResult.java
@@ -1,13 +1,13 @@
package seedu.addressbook.commands;
+import java.util.List;
+import java.util.Optional;
+
import seedu.addressbook.data.finance.ReadOnlyFinance;
import seedu.addressbook.data.match.ReadOnlyMatch;
import seedu.addressbook.data.player.ReadOnlyPlayer;
import seedu.addressbook.data.team.ReadOnlyTeam;
-import java.util.List;
-import java.util.Optional;
-
/**
* Represents the result of a command execution.
*/
From b62033417fe957d442ca626c9990f3e9d8f92e9d Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 10:18:57 +0800
Subject: [PATCH 11/19] edit to pass travis attempt 4
---
src/seedu/addressbook/commands/Command.java | 10 ++---
.../addressbook/commands/HelpCommand.java | 8 +++-
.../commands/player/AddCommand.java | 21 ++++++++--
.../commands/player/AddFastCommand.java | 16 ++++++--
.../commands/player/FindCommand.java | 8 +++-
.../commands/player/ListCommand.java | 3 +-
src/seedu/addressbook/data/match/Match.java | 5 ++-
.../addressbook/data/player/Country.java | 5 ++-
src/seedu/addressbook/data/player/Name.java | 4 +-
src/seedu/addressbook/data/player/Player.java | 7 ++--
.../data/player/ReadOnlyPlayer.java | 5 +--
src/seedu/addressbook/data/player/Team.java | 4 +-
.../data/player/UniquePlayerList.java | 10 ++++-
.../addressbook/data/team/ReadOnlyTeam.java | 3 +-
src/seedu/addressbook/data/team/Team.java | 7 ++--
src/seedu/addressbook/logic/Logic.java | 8 ++--
src/seedu/addressbook/parser/Parser.java | 41 +++++++++++++++----
.../addressbook/storage/StorageFile.java | 21 +++++++---
.../storage/jaxb/AdaptedAddressBook.java | 10 +++--
.../storage/jaxb/AdaptedMatch.java | 18 +++++---
.../storage/jaxb/AdaptedPlayer.java | 25 ++++++++---
.../addressbook/storage/jaxb/AdaptedTeam.java | 18 ++++----
src/seedu/addressbook/ui/Formatter.java | 6 +--
src/seedu/addressbook/ui/MainWindow.java | 9 ++--
24 files changed, 187 insertions(+), 85 deletions(-)
diff --git a/src/seedu/addressbook/commands/Command.java b/src/seedu/addressbook/commands/Command.java
index a89fb9b8b..c77cdaa5c 100644
--- a/src/seedu/addressbook/commands/Command.java
+++ b/src/seedu/addressbook/commands/Command.java
@@ -1,5 +1,9 @@
package seedu.addressbook.commands;
+import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;
+
+import java.util.List;
+
import seedu.addressbook.common.Messages;
import seedu.addressbook.data.AddressBook;
import seedu.addressbook.data.finance.ReadOnlyFinance;
@@ -7,12 +11,6 @@
import seedu.addressbook.data.player.ReadOnlyPlayer;
import seedu.addressbook.data.team.ReadOnlyTeam;
-import java.util.List;
-
-import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;
-
-
-
/**
* Represents an executable command.
diff --git a/src/seedu/addressbook/commands/HelpCommand.java b/src/seedu/addressbook/commands/HelpCommand.java
index 23def5028..a929215bf 100644
--- a/src/seedu/addressbook/commands/HelpCommand.java
+++ b/src/seedu/addressbook/commands/HelpCommand.java
@@ -7,7 +7,13 @@
import seedu.addressbook.commands.match.DeleteMatchCommand;
import seedu.addressbook.commands.match.FindMatchCommand;
import seedu.addressbook.commands.match.ListMatchCommand;
-import seedu.addressbook.commands.player.*;
+import seedu.addressbook.commands.player.AddCommand;
+import seedu.addressbook.commands.player.ClearCommand;
+import seedu.addressbook.commands.player.DeleteCommand;
+import seedu.addressbook.commands.player.FindCommand;
+import seedu.addressbook.commands.player.ListCommand;
+import seedu.addressbook.commands.player.SortCommand;
+import seedu.addressbook.commands.player.ViewAllCommand;
import seedu.addressbook.commands.team.AddTeam;
import seedu.addressbook.commands.team.ClearTeam;
import seedu.addressbook.commands.team.DeleteTeam;
diff --git a/src/seedu/addressbook/commands/player/AddCommand.java b/src/seedu/addressbook/commands/player/AddCommand.java
index dbfc42995..9bb107fb1 100644
--- a/src/seedu/addressbook/commands/player/AddCommand.java
+++ b/src/seedu/addressbook/commands/player/AddCommand.java
@@ -1,14 +1,27 @@
package seedu.addressbook.commands.player;
+import java.util.HashSet;
+import java.util.Set;
+
import seedu.addressbook.commands.Command;
import seedu.addressbook.commands.CommandResult;
import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.data.player.*;
+import seedu.addressbook.data.player.Age;
+import seedu.addressbook.data.player.Appearance;
+import seedu.addressbook.data.player.Country;
+import seedu.addressbook.data.player.GoalsAssisted;
+import seedu.addressbook.data.player.GoalsScored;
+import seedu.addressbook.data.player.HealthStatus;
+import seedu.addressbook.data.player.JerseyNumber;
+import seedu.addressbook.data.player.Name;
+import seedu.addressbook.data.player.Player;
+import seedu.addressbook.data.player.PositionPlayed;
+import seedu.addressbook.data.player.ReadOnlyPlayer;
+import seedu.addressbook.data.player.Salary;
+import seedu.addressbook.data.player.Team;
+import seedu.addressbook.data.player.UniquePlayerList;
import seedu.addressbook.data.tag.Tag;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* Adds a player to the address book.
*/
diff --git a/src/seedu/addressbook/commands/player/AddFastCommand.java b/src/seedu/addressbook/commands/player/AddFastCommand.java
index e918e8c77..848570fee 100644
--- a/src/seedu/addressbook/commands/player/AddFastCommand.java
+++ b/src/seedu/addressbook/commands/player/AddFastCommand.java
@@ -1,13 +1,23 @@
package seedu.addressbook.commands.player;
+import java.util.HashSet;
+import java.util.Set;
+
import seedu.addressbook.commands.Command;
import seedu.addressbook.commands.CommandResult;
import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.data.player.*;
+import seedu.addressbook.data.player.Country;
+import seedu.addressbook.data.player.Name;
+import seedu.addressbook.data.player.Team;
+import seedu.addressbook.data.player.Age;
+import seedu.addressbook.data.player.JerseyNumber;
+import seedu.addressbook.data.player.Player;
+import seedu.addressbook.data.player.PositionPlayed;
+import seedu.addressbook.data.player.ReadOnlyPlayer;
+import seedu.addressbook.data.player.Salary;
+import seedu.addressbook.data.player.UniquePlayerList;
import seedu.addressbook.data.tag.Tag;
-import java.util.HashSet;
-import java.util.Set;
/**
* Adds a player to the address book.
diff --git a/src/seedu/addressbook/commands/player/FindCommand.java b/src/seedu/addressbook/commands/player/FindCommand.java
index eaacae9e6..868dfd963 100644
--- a/src/seedu/addressbook/commands/player/FindCommand.java
+++ b/src/seedu/addressbook/commands/player/FindCommand.java
@@ -1,11 +1,15 @@
package seedu.addressbook.commands.player;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import seedu.addressbook.commands.Command;
import seedu.addressbook.commands.CommandResult;
import seedu.addressbook.data.player.ReadOnlyPlayer;
-import java.util.*;
-
/**
* Finds and lists all players in the league whose name contains any of the argument keywords.
* Keyword matching is case sensitive.
diff --git a/src/seedu/addressbook/commands/player/ListCommand.java b/src/seedu/addressbook/commands/player/ListCommand.java
index 94d96a708..2f48b3057 100644
--- a/src/seedu/addressbook/commands/player/ListCommand.java
+++ b/src/seedu/addressbook/commands/player/ListCommand.java
@@ -1,10 +1,11 @@
package seedu.addressbook.commands.player;
+import java.util.List;
+
import seedu.addressbook.commands.Command;
import seedu.addressbook.commands.CommandResult;
import seedu.addressbook.data.player.ReadOnlyPlayer;
-import java.util.List;
/**
* Lists all players in the league to the user.
diff --git a/src/seedu/addressbook/data/match/Match.java b/src/seedu/addressbook/data/match/Match.java
index 7bf0c83a2..fc544849a 100644
--- a/src/seedu/addressbook/data/match/Match.java
+++ b/src/seedu/addressbook/data/match/Match.java
@@ -1,11 +1,12 @@
package seedu.addressbook.data.match;
-import seedu.addressbook.data.player.Player;
-
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
+import seedu.addressbook.data.player.Player;
+
+
/**
* Represents a match in the address book.
* Guarantees: details are present and not null, field values are validated.
diff --git a/src/seedu/addressbook/data/player/Country.java b/src/seedu/addressbook/data/player/Country.java
index d123af20a..dce0fb766 100644
--- a/src/seedu/addressbook/data/player/Country.java
+++ b/src/seedu/addressbook/data/player/Country.java
@@ -1,10 +1,11 @@
package seedu.addressbook.data.player;
-import seedu.addressbook.data.exception.IllegalValueException;
-
import java.util.Arrays;
import java.util.List;
+import seedu.addressbook.data.exception.IllegalValueException;
+
+
/**
* Represents country of a player made in the address book.
*/
diff --git a/src/seedu/addressbook/data/player/Name.java b/src/seedu/addressbook/data/player/Name.java
index 20110dc6b..2d02e43e1 100644
--- a/src/seedu/addressbook/data/player/Name.java
+++ b/src/seedu/addressbook/data/player/Name.java
@@ -1,10 +1,10 @@
package seedu.addressbook.data.player;
-import seedu.addressbook.data.exception.IllegalValueException;
-
import java.util.Arrays;
import java.util.List;
+import seedu.addressbook.data.exception.IllegalValueException;
+
/**
* Represents a player's name in the address book.
* Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
diff --git a/src/seedu/addressbook/data/player/Player.java b/src/seedu/addressbook/data/player/Player.java
index 634542230..ef4b76b3f 100644
--- a/src/seedu/addressbook/data/player/Player.java
+++ b/src/seedu/addressbook/data/player/Player.java
@@ -1,12 +1,13 @@
package seedu.addressbook.data.player;
-import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.data.tag.Tag;
-
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
+import seedu.addressbook.data.exception.IllegalValueException;
+import seedu.addressbook.data.tag.Tag;
+
+
/**
* Represents a Person in the address book.
* Guarantees: details are present and not null, field values are validated.
diff --git a/src/seedu/addressbook/data/player/ReadOnlyPlayer.java b/src/seedu/addressbook/data/player/ReadOnlyPlayer.java
index b97359f93..544dbfd46 100644
--- a/src/seedu/addressbook/data/player/ReadOnlyPlayer.java
+++ b/src/seedu/addressbook/data/player/ReadOnlyPlayer.java
@@ -1,9 +1,9 @@
package seedu.addressbook.data.player;
-import seedu.addressbook.data.tag.Tag;
-
import java.util.Set;
+import seedu.addressbook.data.tag.Tag;
+
/**
* A read-only immutable interface for a Player in a football league.
* Implementations should guarantee: details are present and not null, field values are validated.
@@ -73,7 +73,6 @@ default String getAsTextShowAll() {
.append("\n").append("Jersey Number: ").append(getJerseyNumber())
.append(" | Appearance: ").append(getAppearance()).append(" | HealthStatus: ")
.append(getHealthStatus()).append(" | Tags: ");
-
for (Tag tag : getTags()) {
builder.append(tag);
}
diff --git a/src/seedu/addressbook/data/player/Team.java b/src/seedu/addressbook/data/player/Team.java
index 0994f171b..6628b642f 100644
--- a/src/seedu/addressbook/data/player/Team.java
+++ b/src/seedu/addressbook/data/player/Team.java
@@ -1,10 +1,10 @@
package seedu.addressbook.data.player;
-import seedu.addressbook.data.exception.IllegalValueException;
-
import java.util.Arrays;
import java.util.List;
+import seedu.addressbook.data.exception.IllegalValueException;
+
/**
* Represents a player's team in the address book.
*/
diff --git a/src/seedu/addressbook/data/player/UniquePlayerList.java b/src/seedu/addressbook/data/player/UniquePlayerList.java
index 8f4a4a645..ca133eb33 100644
--- a/src/seedu/addressbook/data/player/UniquePlayerList.java
+++ b/src/seedu/addressbook/data/player/UniquePlayerList.java
@@ -1,10 +1,16 @@
package seedu.addressbook.data.player;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
import seedu.addressbook.common.Utils;
import seedu.addressbook.data.exception.DuplicateDataException;
-import java.util.*;
-
/**
* A list of players. Does not allow null elements or duplicates.
*
diff --git a/src/seedu/addressbook/data/team/ReadOnlyTeam.java b/src/seedu/addressbook/data/team/ReadOnlyTeam.java
index 81d83215e..3ce932e71 100644
--- a/src/seedu/addressbook/data/team/ReadOnlyTeam.java
+++ b/src/seedu/addressbook/data/team/ReadOnlyTeam.java
@@ -1,9 +1,10 @@
package seedu.addressbook.data.team;
+import java.util.Set;
+
import seedu.addressbook.data.player.Player;
import seedu.addressbook.data.tag.Tag;
-import java.util.Set;
/**
* A read-only immutable interface for a team in the league tracker.
diff --git a/src/seedu/addressbook/data/team/Team.java b/src/seedu/addressbook/data/team/Team.java
index 509c673e5..ba37a1c77 100644
--- a/src/seedu/addressbook/data/team/Team.java
+++ b/src/seedu/addressbook/data/team/Team.java
@@ -1,12 +1,13 @@
package seedu.addressbook.data.team;
-import seedu.addressbook.data.player.Player;
-import seedu.addressbook.data.tag.Tag;
-
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
+import seedu.addressbook.data.player.Player;
+import seedu.addressbook.data.tag.Tag;
+
+
/**
* Represents a team in the address book.
* Guarantees: details are present and not null, field values are validated.
diff --git a/src/seedu/addressbook/logic/Logic.java b/src/seedu/addressbook/logic/Logic.java
index 4e3c4691b..68b8d4027 100644
--- a/src/seedu/addressbook/logic/Logic.java
+++ b/src/seedu/addressbook/logic/Logic.java
@@ -1,5 +1,9 @@
package seedu.addressbook.logic;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+
import seedu.addressbook.commands.Command;
import seedu.addressbook.commands.CommandResult;
import seedu.addressbook.data.AddressBook;
@@ -10,10 +14,6 @@
import seedu.addressbook.parser.Parser;
import seedu.addressbook.storage.StorageFile;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
/**
* Represents the main Logic of the AddressBook.
*/
diff --git a/src/seedu/addressbook/parser/Parser.java b/src/seedu/addressbook/parser/Parser.java
index 25a3bdee8..85071a1c7 100644
--- a/src/seedu/addressbook/parser/Parser.java
+++ b/src/seedu/addressbook/parser/Parser.java
@@ -1,18 +1,41 @@
package seedu.addressbook.parser;
-import seedu.addressbook.commands.*;
-import seedu.addressbook.commands.finance.FinanceCommand;
-import seedu.addressbook.commands.finance.ListFinanceCommand;
-import seedu.addressbook.commands.match.*;
-import seedu.addressbook.commands.player.*;
-import seedu.addressbook.commands.team.*;
-import seedu.addressbook.data.exception.IllegalValueException;
+import static seedu.addressbook.common.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static seedu.addressbook.common.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
+import seedu.addressbook.commands.Command;
+import seedu.addressbook.commands.ExitCommand;
+import seedu.addressbook.commands.HelpCommand;
+import seedu.addressbook.commands.IncorrectCommand;
+import seedu.addressbook.commands.finance.FinanceCommand;
+import seedu.addressbook.commands.finance.ListFinanceCommand;
+import seedu.addressbook.commands.match.AddMatchCommand;
+import seedu.addressbook.commands.match.ClearMatchCommand;
+import seedu.addressbook.commands.match.DeleteMatchCommand;
+import seedu.addressbook.commands.match.FindMatchCommand;
+import seedu.addressbook.commands.match.ListMatchCommand;
+import seedu.addressbook.commands.player.AddCommand;
+import seedu.addressbook.commands.player.AddFastCommand;
+import seedu.addressbook.commands.player.ClearCommand;
+import seedu.addressbook.commands.player.DeleteCommand;
+import seedu.addressbook.commands.player.FindCommand;
+import seedu.addressbook.commands.player.ListCommand;
+import seedu.addressbook.commands.player.SortCommand;
+import seedu.addressbook.commands.player.ViewAllCommand;
+import seedu.addressbook.commands.team.AddTeam;
+import seedu.addressbook.commands.team.ClearTeam;
+import seedu.addressbook.commands.team.DeleteTeam;
+import seedu.addressbook.commands.team.EditTeam;
+import seedu.addressbook.commands.team.FindTeam;
+import seedu.addressbook.commands.team.ListTeam;
+import seedu.addressbook.data.exception.IllegalValueException;
/**
* Parses user input.
diff --git a/src/seedu/addressbook/storage/StorageFile.java b/src/seedu/addressbook/storage/StorageFile.java
index e68e4b296..967ba78f8 100644
--- a/src/seedu/addressbook/storage/StorageFile.java
+++ b/src/seedu/addressbook/storage/StorageFile.java
@@ -1,16 +1,25 @@
package seedu.addressbook.storage;
-import seedu.addressbook.data.AddressBook;
-import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.storage.jaxb.AdaptedAddressBook;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
-import java.io.*;
-import java.nio.file.Path;
-import java.nio.file.Paths;
+
+import seedu.addressbook.data.AddressBook;
+import seedu.addressbook.data.exception.IllegalValueException;
+import seedu.addressbook.storage.jaxb.AdaptedAddressBook;
/**
* Represents the file used to store address book data.
diff --git a/src/seedu/addressbook/storage/jaxb/AdaptedAddressBook.java b/src/seedu/addressbook/storage/jaxb/AdaptedAddressBook.java
index 026ee8283..70f07d32d 100644
--- a/src/seedu/addressbook/storage/jaxb/AdaptedAddressBook.java
+++ b/src/seedu/addressbook/storage/jaxb/AdaptedAddressBook.java
@@ -1,5 +1,11 @@
package seedu.addressbook.storage.jaxb;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
import seedu.addressbook.data.AddressBook;
import seedu.addressbook.data.exception.IllegalValueException;
import seedu.addressbook.data.finance.Finance;
@@ -11,10 +17,6 @@
import seedu.addressbook.data.team.Team;
import seedu.addressbook.data.team.UniqueTeamList;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.ArrayList;
-import java.util.List;
/**
* JAXB-friendly adapted address book data holder class.
diff --git a/src/seedu/addressbook/storage/jaxb/AdaptedMatch.java b/src/seedu/addressbook/storage/jaxb/AdaptedMatch.java
index e8151043d..fe33305bd 100644
--- a/src/seedu/addressbook/storage/jaxb/AdaptedMatch.java
+++ b/src/seedu/addressbook/storage/jaxb/AdaptedMatch.java
@@ -1,16 +1,22 @@
package seedu.addressbook.storage.jaxb;
-import seedu.addressbook.common.Utils;
-import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.data.match.*;
-import seedu.addressbook.data.player.Player;
-
-import javax.xml.bind.annotation.XmlElement;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.xml.bind.annotation.XmlElement;
+
+import seedu.addressbook.common.Utils;
+import seedu.addressbook.data.exception.IllegalValueException;
+import seedu.addressbook.data.match.Away;
+import seedu.addressbook.data.match.Date;
+import seedu.addressbook.data.match.Home;
+import seedu.addressbook.data.match.Match;
+import seedu.addressbook.data.match.ReadOnlyMatch;
+import seedu.addressbook.data.match.TicketSales;
+import seedu.addressbook.data.player.Player;
+
/**
* JAXB-friendly adapted match data holder class.
*/
diff --git a/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java b/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java
index 707f2d913..090237b08 100644
--- a/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java
+++ b/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java
@@ -1,16 +1,29 @@
package seedu.addressbook.storage.jaxb;
-import seedu.addressbook.common.Utils;
-import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.data.player.*;
-import seedu.addressbook.data.tag.Tag;
-
-import javax.xml.bind.annotation.XmlElement;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.xml.bind.annotation.XmlElement;
+
+import seedu.addressbook.common.Utils;
+import seedu.addressbook.data.exception.IllegalValueException;
+import seedu.addressbook.data.player.Age;
+import seedu.addressbook.data.player.Appearance;
+import seedu.addressbook.data.player.Country;
+import seedu.addressbook.data.player.GoalsAssisted;
+import seedu.addressbook.data.player.GoalsScored;
+import seedu.addressbook.data.player.HealthStatus;
+import seedu.addressbook.data.player.JerseyNumber;
+import seedu.addressbook.data.player.Name;
+import seedu.addressbook.data.player.Player;
+import seedu.addressbook.data.player.PositionPlayed;
+import seedu.addressbook.data.player.ReadOnlyPlayer;
+import seedu.addressbook.data.player.Salary;
+import seedu.addressbook.data.player.Team;
+import seedu.addressbook.data.tag.Tag;
+
/**
* JAXB-friendly adapted player data holder class.
*/
diff --git a/src/seedu/addressbook/storage/jaxb/AdaptedTeam.java b/src/seedu/addressbook/storage/jaxb/AdaptedTeam.java
index 3f9d5239c..360533b00 100644
--- a/src/seedu/addressbook/storage/jaxb/AdaptedTeam.java
+++ b/src/seedu/addressbook/storage/jaxb/AdaptedTeam.java
@@ -1,17 +1,21 @@
package seedu.addressbook.storage.jaxb;
-import seedu.addressbook.common.Utils;
-import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.data.player.Player;
-import seedu.addressbook.data.tag.Tag;
-import seedu.addressbook.data.team.*;
-
-import javax.xml.bind.annotation.XmlElement;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.xml.bind.annotation.XmlElement;
+
+import seedu.addressbook.common.Utils;
+import seedu.addressbook.data.exception.IllegalValueException;
+import seedu.addressbook.data.player.Player;
+import seedu.addressbook.data.tag.Tag;
+import seedu.addressbook.data.team.Country;
+import seedu.addressbook.data.team.Name;
+import seedu.addressbook.data.team.ReadOnlyTeam;
+import seedu.addressbook.data.team.Sponsor;
+import seedu.addressbook.data.team.Team;
/**
* JAXB-friendly adapted team data holder class.
diff --git a/src/seedu/addressbook/ui/Formatter.java b/src/seedu/addressbook/ui/Formatter.java
index 8c1c450cd..5fa90d666 100644
--- a/src/seedu/addressbook/ui/Formatter.java
+++ b/src/seedu/addressbook/ui/Formatter.java
@@ -1,13 +1,13 @@
package seedu.addressbook.ui;
+import java.util.ArrayList;
+import java.util.List;
+
import seedu.addressbook.data.finance.ReadOnlyFinance;
import seedu.addressbook.data.match.ReadOnlyMatch;
import seedu.addressbook.data.player.ReadOnlyPlayer;
import seedu.addressbook.data.team.ReadOnlyTeam;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Used for formatting text for display. e.g. for adding text decorations.
*/
diff --git a/src/seedu/addressbook/ui/MainWindow.java b/src/seedu/addressbook/ui/MainWindow.java
index a2ea120fa..60a3e5808 100644
--- a/src/seedu/addressbook/ui/MainWindow.java
+++ b/src/seedu/addressbook/ui/MainWindow.java
@@ -1,5 +1,8 @@
package seedu.addressbook.ui;
+import java.util.List;
+import java.util.Optional;
+
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
@@ -12,10 +15,10 @@
import seedu.addressbook.data.team.ReadOnlyTeam;
import seedu.addressbook.logic.Logic;
-import java.util.List;
-import java.util.Optional;
-import static seedu.addressbook.common.Messages.*;
+import static seedu.addressbook.common.Messages.MESSAGE_PROGRAM_LAUNCH_ARGS_USAGE;
+import static seedu.addressbook.common.Messages.MESSAGE_USING_STORAGE_FILE;
+import static seedu.addressbook.common.Messages.MESSAGE_WELCOME;
/**
From 767d11990e4bb5116e62228b1842d9360400c429 Mon Sep 17 00:00:00 2001
From: warheade <35769004+warheade@users.noreply.github.com>
Date: Sat, 30 Mar 2019 10:28:11 +0800
Subject: [PATCH 12/19] Update Command.java
---
src/seedu/addressbook/commands/Command.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/seedu/addressbook/commands/Command.java b/src/seedu/addressbook/commands/Command.java
index c1bc33d09..dd1bed4a2 100644
--- a/src/seedu/addressbook/commands/Command.java
+++ b/src/seedu/addressbook/commands/Command.java
@@ -1,9 +1,5 @@
package seedu.addressbook.commands;
-import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;
-
-import java.util.List;
-
import seedu.addressbook.common.Messages;
import seedu.addressbook.data.AddressBook;
import seedu.addressbook.data.finance.ReadOnlyFinance;
@@ -11,6 +7,12 @@
import seedu.addressbook.data.player.ReadOnlyPlayer;
import seedu.addressbook.data.team.ReadOnlyTeam;
+import java.util.List;
+
+import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;
+
+
+
/**
* Represents an executable command.
*/
From 00322d7a398b2f73dbf0ce7a0eb00cf60bea725f Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 10:35:13 +0800
Subject: [PATCH 13/19] edit to fix code for checkstyle attempt 6
---
src/seedu/addressbook/commands/Command.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/seedu/addressbook/commands/Command.java b/src/seedu/addressbook/commands/Command.java
index cf8c73586..c77cdaa5c 100644
--- a/src/seedu/addressbook/commands/Command.java
+++ b/src/seedu/addressbook/commands/Command.java
@@ -1,5 +1,9 @@
package seedu.addressbook.commands;
+import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;
+
+import java.util.List;
+
import seedu.addressbook.common.Messages;
import seedu.addressbook.data.AddressBook;
import seedu.addressbook.data.finance.ReadOnlyFinance;
@@ -8,12 +12,6 @@
import seedu.addressbook.data.team.ReadOnlyTeam;
-import java.util.List;
-
-import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;
-
-
-
/**
* Represents an executable command.
*/
From 5a66d8b09be4b5f0be3c227fe8d48a8918084ba9 Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 10:46:23 +0800
Subject: [PATCH 14/19] edit code to pass checkstyle attempt ronaldo
---
.../addressbook/commands/player/AddFastCommand.java | 7 +++----
src/seedu/addressbook/data/match/ReadOnlyMatch.java | 3 ++-
.../addressbook/storage/jaxb/AdaptedPlayer.java | 12 ++++++------
src/seedu/addressbook/ui/MainWindow.java | 1 -
4 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/seedu/addressbook/commands/player/AddFastCommand.java b/src/seedu/addressbook/commands/player/AddFastCommand.java
index 848570fee..1ec124cec 100644
--- a/src/seedu/addressbook/commands/player/AddFastCommand.java
+++ b/src/seedu/addressbook/commands/player/AddFastCommand.java
@@ -6,19 +6,18 @@
import seedu.addressbook.commands.Command;
import seedu.addressbook.commands.CommandResult;
import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.data.player.Country;
-import seedu.addressbook.data.player.Name;
-import seedu.addressbook.data.player.Team;
import seedu.addressbook.data.player.Age;
+import seedu.addressbook.data.player.Country;
import seedu.addressbook.data.player.JerseyNumber;
+import seedu.addressbook.data.player.Name;
import seedu.addressbook.data.player.Player;
import seedu.addressbook.data.player.PositionPlayed;
import seedu.addressbook.data.player.ReadOnlyPlayer;
import seedu.addressbook.data.player.Salary;
+import seedu.addressbook.data.player.Team;
import seedu.addressbook.data.player.UniquePlayerList;
import seedu.addressbook.data.tag.Tag;
-
/**
* Adds a player to the address book.
* With some fields set as default to make adding more user friendly
diff --git a/src/seedu/addressbook/data/match/ReadOnlyMatch.java b/src/seedu/addressbook/data/match/ReadOnlyMatch.java
index dbdf8f1f9..1b63a2e5a 100644
--- a/src/seedu/addressbook/data/match/ReadOnlyMatch.java
+++ b/src/seedu/addressbook/data/match/ReadOnlyMatch.java
@@ -1,8 +1,9 @@
package seedu.addressbook.data.match;
+import java.util.Set;
+
import seedu.addressbook.data.player.Player;
-import java.util.Set;
/**
* A read-only immutable interface for a match in the addressbook.
diff --git a/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java b/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java
index 090237b08..2e5d90061 100644
--- a/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java
+++ b/src/seedu/addressbook/storage/jaxb/AdaptedPlayer.java
@@ -32,12 +32,12 @@ public class AdaptedPlayer {
/**
* JAXB-friendly place holder for information.
*/
-// private static class AdaptedPlayerDetail {
-// @XmlValue
-// private String value;
-// @XmlAttribute(required = true)
-// private boolean isPrivate;
-// }
+ // private static class AdaptedPlayerDetail {
+ // @XmlValue
+ // private String value;
+ // @XmlAttribute(required = true)
+ // private boolean isPrivate;
+ // }
@XmlElement(required = true)
private String name;
diff --git a/src/seedu/addressbook/ui/MainWindow.java b/src/seedu/addressbook/ui/MainWindow.java
index 60a3e5808..1dae21130 100644
--- a/src/seedu/addressbook/ui/MainWindow.java
+++ b/src/seedu/addressbook/ui/MainWindow.java
@@ -15,7 +15,6 @@
import seedu.addressbook.data.team.ReadOnlyTeam;
import seedu.addressbook.logic.Logic;
-
import static seedu.addressbook.common.Messages.MESSAGE_PROGRAM_LAUNCH_ARGS_USAGE;
import static seedu.addressbook.common.Messages.MESSAGE_USING_STORAGE_FILE;
import static seedu.addressbook.common.Messages.MESSAGE_WELCOME;
From 4702b69ba98ee46ce1c3d00e50b7f7e13c7d731d Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 10:51:47 +0800
Subject: [PATCH 15/19] edit to fix code for checkstyle attempt 8
---
src/seedu/addressbook/ui/MainWindow.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/seedu/addressbook/ui/MainWindow.java b/src/seedu/addressbook/ui/MainWindow.java
index 1dae21130..568740f18 100644
--- a/src/seedu/addressbook/ui/MainWindow.java
+++ b/src/seedu/addressbook/ui/MainWindow.java
@@ -1,5 +1,9 @@
package seedu.addressbook.ui;
+import static seedu.addressbook.common.Messages.MESSAGE_PROGRAM_LAUNCH_ARGS_USAGE;
+import static seedu.addressbook.common.Messages.MESSAGE_USING_STORAGE_FILE;
+import static seedu.addressbook.common.Messages.MESSAGE_WELCOME;
+
import java.util.List;
import java.util.Optional;
@@ -7,6 +11,7 @@
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
+
import seedu.addressbook.commands.CommandResult;
import seedu.addressbook.commands.ExitCommand;
import seedu.addressbook.data.finance.ReadOnlyFinance;
@@ -15,11 +20,6 @@
import seedu.addressbook.data.team.ReadOnlyTeam;
import seedu.addressbook.logic.Logic;
-import static seedu.addressbook.common.Messages.MESSAGE_PROGRAM_LAUNCH_ARGS_USAGE;
-import static seedu.addressbook.common.Messages.MESSAGE_USING_STORAGE_FILE;
-import static seedu.addressbook.common.Messages.MESSAGE_WELCOME;
-
-
/**
* Main Window of the GUI.
*/
From 7b7400e6d3be56172c18e0446622e82d6d1b3a41 Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 11:13:29 +0800
Subject: [PATCH 16/19] edit to fix code style attempt Suarez
---
.../seedu/addressbook/logic/LogicTest.java | 244 ++++++++++--------
.../seedu/addressbook/parser/ParserTest.java | 218 +++++++++-------
2 files changed, 267 insertions(+), 195 deletions(-)
diff --git a/test/java/seedu/addressbook/logic/LogicTest.java b/test/java/seedu/addressbook/logic/LogicTest.java
index b7b73721b..142fb31f7 100644
--- a/test/java/seedu/addressbook/logic/LogicTest.java
+++ b/test/java/seedu/addressbook/logic/LogicTest.java
@@ -1,25 +1,49 @@
package seedu.addressbook.logic;
+import static junit.framework.TestCase.assertEquals;
+import static seedu.addressbook.common.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringJoiner;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+
import seedu.addressbook.commands.Command;
import seedu.addressbook.commands.CommandResult;
import seedu.addressbook.commands.ExitCommand;
import seedu.addressbook.commands.HelpCommand;
-import seedu.addressbook.commands.player.*;
+import seedu.addressbook.commands.player.AddCommand;
+import seedu.addressbook.commands.player.AddFastCommand;
+import seedu.addressbook.commands.player.ClearCommand;
+import seedu.addressbook.commands.player.DeleteCommand;
+import seedu.addressbook.commands.player.FindCommand;
+import seedu.addressbook.commands.player.ViewAllCommand;
import seedu.addressbook.common.Messages;
import seedu.addressbook.data.AddressBook;
-import seedu.addressbook.data.player.*;
+import seedu.addressbook.data.player.Age;
+import seedu.addressbook.data.player.Appearance;
+import seedu.addressbook.data.player.Country;
+import seedu.addressbook.data.player.GoalsAssisted;
+import seedu.addressbook.data.player.GoalsScored;
+import seedu.addressbook.data.player.HealthStatus;
+import seedu.addressbook.data.player.JerseyNumber;
+import seedu.addressbook.data.player.Name;
+import seedu.addressbook.data.player.Player;
+import seedu.addressbook.data.player.PositionPlayed;
+import seedu.addressbook.data.player.ReadOnlyPlayer;
+import seedu.addressbook.data.player.Salary;
+import seedu.addressbook.data.player.Team;
import seedu.addressbook.data.tag.Tag;
import seedu.addressbook.storage.StorageFile;
-import java.util.*;
-
-import static junit.framework.TestCase.assertEquals;
-import static seedu.addressbook.common.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
-
public class LogicTest {
/**
@@ -58,6 +82,7 @@ public void execute_invalid() throws Exception {
/**
* Executes the command and confirms that the result message is correct.
* Both the 'address book' and the 'last shown list' are expected to be empty.
+ *
* @see #assertCommandBehavior(String, String, AddressBook, boolean, List)
*/
private void assertCommandBehavior(String inputCommand, String expectedMessage) throws Exception {
@@ -67,15 +92,15 @@ private void assertCommandBehavior(String inputCommand, String expectedMessage)
/**
* Executes the command and confirms that the result message is correct and
* also confirms that the following three parts of the Logic object's state are as expected:
- * - the internal address book data are same as those in the {@code expectedAddressBook}
- * - the internal 'last shown list' matches the {@code expectedLastList}
- * - the storage file content matches data in {@code expectedAddressBook}
+ * - the internal address book data are same as those in the {@code expectedAddressBook}
+ * - the internal 'last shown list' matches the {@code expectedLastList}
+ * - the storage file content matches data in {@code expectedAddressBook}
*/
private void assertCommandBehavior(String inputCommand,
- String expectedMessage,
- AddressBook expectedAddressBook,
- boolean isRelevantPlayersExpected,
- List extends ReadOnlyPlayer> lastPlayerList) throws Exception {
+ String expectedMessage,
+ AddressBook expectedAddressBook,
+ boolean isRelevantPlayersExpected,
+ List extends ReadOnlyPlayer> lastPlayerList) throws Exception {
//Execute the command
CommandResult r = logic.execute(inputCommand);
@@ -131,58 +156,57 @@ public void execute_add_invalidArgsFormat() throws Exception {
//no position prefix
assertCommandBehavior(
- "addPlayer Valid Name Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoPositionPrefix ctry/China" +
- "jn/9 app/0 hs/Healthy", expectedMessage);
+ "addPlayer Valid Name Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoPositionPrefix ctry/China"
+ + "jn/9 app/0 hs/Healthy", expectedMessage);
//no age prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker 30 sal/20000 gs/0 ga/0 tm/validTeam.butNoAgePrefix ctry/China" +
- "jn/9 app/0 hs/Healthy", expectedMessage);
+ "addPlayer Valid Name p/Striker 30 sal/20000 gs/0 ga/0 tm/validTeam.butNoAgePrefix ctry/China"
+ + "jn/9 app/0 hs/Healthy", expectedMessage);
//no salary prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 20000 gs/0 ga/0 tm/validTeam.butNoSalaryPrefix ctry/China" +
- "jn/9 app/0 hs/Healthy", expectedMessage);
+ "addPlayer Valid Name p/Striker a/30 20000 gs/0 ga/0 tm/validTeam.butNoSalaryPrefix ctry/China"
+ + "jn/9 app/0 hs/Healthy", expectedMessage);
//no goals scored prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 0 ga/0 tm/validTeam.butNoGoalsScoredPrefix ctry/China" +
- "jn/9 app/0 hs/Healthy", expectedMessage);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 0 ga/0 tm/validTeam.butNoGoalsScoredPrefix ctry/China"
+ + "jn/9 app/0 hs/Healthy", expectedMessage);
//no goals assisted prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 0 tm/validTeam.butNoGoalsAssistedPrefix ctry/China" +
- "jn/9 app/0 hs/Healthy", expectedMessage);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 0 tm/validTeam.butNoGoalsAssistedPrefix ctry/China"
+ + "jn/9 app/0 hs/Healthy", expectedMessage);
//no team prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 validTeam.butNoPrefix ctry/China" +
- "jn/9 app/0 hs/Healthy", expectedMessage);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 validTeam.butNoPrefix ctry/China"
+ + "jn/9 app/0 hs/Healthy", expectedMessage);
//no country prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoCountryPrefix China" +
- "jn/9 app/0 hs/Healthy", expectedMessage);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoCountryPrefix China"
+ + "jn/9 app/0 hs/Healthy", expectedMessage);
//no jersey number prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoJerseyNumberPrefix ctry/China" +
- "9 app/0 hs/Healthy", expectedMessage);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoJerseyNumberPrefix ctry/China"
+ + "9 app/0 hs/Healthy", expectedMessage);
//no appearance prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoAppearancePrefix ctry/China" +
- "jn/9 0 hs/Healthy", expectedMessage);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoAppearancePrefix ctry/China"
+ + "jn/9 0 hs/Healthy", expectedMessage);
//no health status prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoHealthStatusPrefix ctry/China" +
- "jn/9 app/0 Healthy", expectedMessage);
-
- }
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoHealthStatusPrefix ctry/China"
+ + "jn/9 app/0 Healthy", expectedMessage);
+ }
@Test
- public void execute_addFast_invalidArgsFormat() throws Exception{
+ public void execute_addFast_invalidArgsFormat() throws Exception {
String expectedMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddFastCommand.MESSAGE_USAGE);
assertCommandBehavior(
@@ -215,26 +239,34 @@ public void execute_addFast_invalidArgsFormat() throws Exception{
@Test
public void execute_add_invalidPlayerData() throws Exception {
assertCommandBehavior(
- "addPlayer []\\[;] p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China" +
- "jn/9 app/0 hs/Healthy", Name.MESSAGE_NAME_CONSTRAINTS);
+ "addPlayer []\\[;] p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China"
+ + "jn/9 app/0 hs/Healthy", Name.MESSAGE_NAME_CONSTRAINTS);
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/thirty sal/20000 gs/0 ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy", Age.MESSAGE_AGE_CONSTRAINTS);
+ "addPlayer Valid Name p/Striker a/thirty sal/20000 gs/0 ga/0 tm/validTeam ctry/China "
+ + "jn/9 app/0 hs/Healthy", Age.MESSAGE_AGE_CONSTRAINTS);
// assertCommandBehavior(
// "addPlayer Valid Name p/Striker a/800 sal/20000 gs/0 ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy", Age.MESSAGE_AGE_CONSTRAINTS);
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/zero gs/0 ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy", Salary.MESSAGE_SALARY_CONSTRAINTS);
+ "addPlayer Valid Name p/Striker a/30 sal/zero gs/0 ga/0 tm/validTeam ctry/China "
+ + "jn/9 app/0 hs/Healthy", Salary.MESSAGE_SALARY_CONSTRAINTS);
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/zero ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy", GoalsScored.MESSAGE_GS_CONSTRAINTS);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/zero ga/0 tm/validTeam ctry/China "
+ + "jn/9 app/0 hs/Healthy", GoalsScored.MESSAGE_GS_CONSTRAINTS);
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/zero tm/validTeam ctry/China jn/9 app/0 hs/Healthy", GoalsAssisted.MESSAGE_GA_CONSTRAINTS);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/zero tm/validTeam ctry/China "
+ + "jn/9 app/0 hs/Healthy", GoalsAssisted.MESSAGE_GA_CONSTRAINTS);
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China jn/50 app/0 hs/Healthy", JerseyNumber.MESSAGE_JN_CONSTRAINTS);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China "
+ + "jn/50 app/0 hs/Healthy", JerseyNumber.MESSAGE_JN_CONSTRAINTS);
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China jn/nine app/0 hs/Healthy", JerseyNumber.MESSAGE_JN_CONSTRAINTS);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China "
+ + "jn/nine app/0 hs/Healthy", JerseyNumber.MESSAGE_JN_CONSTRAINTS);
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China jn/9 app/zero hs/Healthy", Appearance.MESSAGE_APPEARANCE_CONSTRAINTS);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China "
+ + "jn/9 app/zero hs/Healthy", Appearance.MESSAGE_APPEARANCE_CONSTRAINTS);
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy t/invalid_-[.tag", Tag.MESSAGE_TAG_CONSTRAINTS);
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam ctry/China "
+ + "jn/9 app/0 hs/Healthy t/invalid_-[.tag", Tag.MESSAGE_TAG_CONSTRAINTS);
}
@Test
@@ -247,10 +279,10 @@ public void execute_add_successful() throws Exception {
// execute command and verify result
assertCommandBehavior(helper.generateAddCommand(toBeAdded),
- String.format(AddCommand.MESSAGE_SUCCESS, toBeAdded),
- expectedAb,
- false,
- Collections.emptyList());
+ String.format(AddCommand.MESSAGE_SUCCESS, toBeAdded),
+ expectedAb,
+ false,
+ Collections.emptyList());
}
@@ -286,17 +318,17 @@ public void execute_list_showsAllPersons() throws Exception {
helper.addToAddressBook(addressBook, 2);
assertCommandBehavior("list",
- Command.getMessageForPlayerListShownSummary(expectedList),
- expectedAb,
- true,
- expectedList);
+ Command.getMessageForPlayerListShownSummary(expectedList),
+ expectedAb,
+ true,
+ expectedList);
}
-
/**
* Confirms the 'invalid argument index number behaviour' for the given command
* targeting a single player in the last shown list, using visible index.
+ *
* @param commandWord to test assuming it targets a single player in the last shown list based on visible index.
*/
private void assertInvalidIndexBehaviorForCommand(String commandWord) throws Exception {
@@ -358,10 +390,10 @@ public void execute_tryToViewAllPlayerMissingInAddressBook_errorMessage() throws
logic.setLastPlayerShownList(lastPlayerList);
assertCommandBehavior("viewall 2",
- Messages.MESSAGE_PLAYER_NOT_IN_LEAGUE,
- expectedAb,
- false,
- lastPlayerList);
+ Messages.MESSAGE_PLAYER_NOT_IN_LEAGUE,
+ expectedAb,
+ false,
+ lastPlayerList);
}
@Test
@@ -392,10 +424,10 @@ public void execute_delete_removesCorrectPerson() throws Exception {
logic.setLastPlayerShownList(threePlayers);
assertCommandBehavior("delete 2",
- String.format(DeleteCommand.MESSAGE_DELETE_PLAYER_SUCCESS, p2),
- expectedAb,
- false,
- threePlayers);
+ String.format(DeleteCommand.MESSAGE_DELETE_PLAYER_SUCCESS, p2),
+ expectedAb,
+ false,
+ threePlayers);
}
@Test
@@ -416,10 +448,10 @@ public void execute_delete_missingInAddressBook() throws Exception {
logic.setLastPlayerShownList(threePlayers);
assertCommandBehavior("delete 2",
- Messages.MESSAGE_PLAYER_NOT_IN_LEAGUE,
- expectedAb,
- false,
- threePlayers);
+ Messages.MESSAGE_PLAYER_NOT_IN_LEAGUE,
+ expectedAb,
+ false,
+ threePlayers);
}
@Test
@@ -442,10 +474,10 @@ public void execute_find_onlyMatchesFullWordsInNames() throws Exception {
helper.addToAddressBook(addressBook, fourPlayers);
assertCommandBehavior("find KEY",
- Command.getMessageForPlayerListShownSummary(expectedList),
- expectedAb,
- true,
- expectedList);
+ Command.getMessageForPlayerListShownSummary(expectedList),
+ expectedAb,
+ true,
+ expectedList);
}
@Test
@@ -462,10 +494,10 @@ public void execute_find_isCaseSensitive() throws Exception {
helper.addToAddressBook(addressBook, fourPlayers);
assertCommandBehavior("find KEY",
- Command.getMessageForPlayerListShownSummary(expectedList),
- expectedAb,
- true,
- expectedList);
+ Command.getMessageForPlayerListShownSummary(expectedList),
+ expectedAb,
+ true,
+ expectedList);
}
@Test
@@ -482,10 +514,10 @@ public void execute_find_matchesIfAnyKeywordPresent() throws Exception {
helper.addToAddressBook(addressBook, fourPlayers);
assertCommandBehavior("find KEY rAnDoM",
- Command.getMessageForPlayerListShownSummary(expectedList),
- expectedAb,
- true,
- expectedList);
+ Command.getMessageForPlayerListShownSummary(expectedList),
+ expectedAb,
+ true,
+ expectedList);
}
/**
@@ -511,7 +543,8 @@ Player messi() throws Exception {
Tag tag1 = new Tag("tag1");
Tag tag2 = new Tag("tag2");
Set tags = new HashSet<>(Arrays.asList(tag1, tag2));
- return new Player(name,positionPlayed,age,sal,goalsScored,goalsAssisted,team,country,jerseyNumber,appearance,healthStatus,tags);
+ return new Player(name, positionPlayed, age, sal, goalsScored, goalsAssisted,
+ team, country, jerseyNumber, appearance, healthStatus, tags);
}
/**
@@ -520,39 +553,40 @@ Player messi() throws Exception {
* Each unique seed will generate a unique Person object.
*
* @param seed used to generate the player data field values
- *
- * */
+ */
Player generatePlayer(int seed) throws Exception {
return new Player(
new Name("Player " + seed),
new PositionPlayed("Position" + seed),
- new Age(""+ Math.abs(seed)),
- new Salary(""+Math.abs(seed)),
- new Team("Team"+Math.abs(seed)),
- new Country("Country"+Math.abs(seed)),
- new JerseyNumber(""+(Math.abs(seed)%35)),
+ new Age("" + Math.abs(seed)),
+ new Salary("" + Math.abs(seed)),
+ new Team("Team" + Math.abs(seed)),
+ new Country("Country" + Math.abs(seed)),
+ new JerseyNumber("" + (Math.abs(seed) % 35)),
new HashSet<>(Arrays.asList(new Tag("tag" + Math.abs(seed)), new Tag("tag" + Math.abs(seed + 1))))
);
}
- /** Generates the correct add command based on the player given */
+ /**
+ * Generates the correct add command based on the player given
+ */
String generateAddCommand(Player p) {
StringJoiner cmd = new StringJoiner(" ");
cmd.add("addPlayer");
cmd.add(p.getName().toString());
- cmd.add(" p/"+p.getPositionPlayed().toString());
- cmd.add(" a/"+p.getAge().toString());
- cmd.add(" sal/"+p.getSalary().toString());
- cmd.add(" gs/"+p.getGoalsScored().toString());
- cmd.add(" ga/"+p.getGoalsAssisted().toString());
- cmd.add(" tm/"+p.getTeam().toString());
- cmd.add(" ctry/"+p.getCountry().toString());
- cmd.add(" jn/"+p.getJerseyNumber().toString());
- cmd.add(" app/"+p.getAppearance().toString());
- cmd.add(" hs/"+p.getHealthStatus().toString());
+ cmd.add(" p/" + p.getPositionPlayed().toString());
+ cmd.add(" a/" + p.getAge().toString());
+ cmd.add(" sal/" + p.getSalary().toString());
+ cmd.add(" gs/" + p.getGoalsScored().toString());
+ cmd.add(" ga/" + p.getGoalsAssisted().toString());
+ cmd.add(" tm/" + p.getTeam().toString());
+ cmd.add(" ctry/" + p.getCountry().toString());
+ cmd.add(" jn/" + p.getJerseyNumber().toString());
+ cmd.add(" app/" + p.getAppearance().toString());
+ cmd.add(" hs/" + p.getHealthStatus().toString());
Set tags = p.getTags();
- for (Tag t: tags) {
+ for (Tag t : tags) {
cmd.add("t/" + t.tagName);
}
return cmd.toString();
@@ -560,6 +594,7 @@ String generateAddCommand(Player p) {
/**
* Generates an AddressBook with auto-generated persons.
+ *
* @param num to indicate the number of player profiles that should be included in the League Tracker.
*/
AddressBook generateAddressBook(int num) throws Exception {
@@ -579,8 +614,9 @@ AddressBook generateAddressBook(List players) throws Exception {
/**
* Adds auto-generated Person objects to the given AddressBook
+ *
* @param addressBook The AddressBook to which the Persons will be added
- * @param num to indicate the number of players profiles that should exist in the League Tracker.
+ * @param num to indicate the number of players profiles that should exist in the League Tracker.
*/
void addToAddressBook(AddressBook addressBook, int num) throws Exception {
addToAddressBook(addressBook, generatePlayerList(num));
@@ -590,7 +626,7 @@ void addToAddressBook(AddressBook addressBook, int num) throws Exception {
* Adds the given list of Persons to the given AddressBook
*/
void addToAddressBook(AddressBook addressBook, List playersToAdd) throws Exception {
- for (Player p: playersToAdd) {
+ for (Player p : playersToAdd) {
addressBook.addPlayer(p);
}
}
@@ -600,7 +636,7 @@ void addToAddressBook(AddressBook addressBook, List playersToAdd) throws
*/
List generatePlayerList(Player... players) throws Exception {
List personList = new ArrayList<>();
- for (Player p: players) {
+ for (Player p : players) {
personList.add(p);
}
return personList;
@@ -611,7 +647,7 @@ List generatePlayerList(Player... players) throws Exception {
*/
List generatePlayerList(int num) throws Exception {
List players = new ArrayList<>();
- for (int j=1;j<=num;j++) {
+ for (int j = 1; j <= num; j++) {
players.add(generatePlayer(j));
}
return players;
diff --git a/test/java/seedu/addressbook/parser/ParserTest.java b/test/java/seedu/addressbook/parser/ParserTest.java
index b67bfa6c5..b835fc552 100644
--- a/test/java/seedu/addressbook/parser/ParserTest.java
+++ b/test/java/seedu/addressbook/parser/ParserTest.java
@@ -1,24 +1,42 @@
package seedu.addressbook.parser;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static seedu.addressbook.common.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
import org.junit.Before;
import org.junit.Test;
+
import seedu.addressbook.commands.Command;
import seedu.addressbook.commands.ExitCommand;
import seedu.addressbook.commands.HelpCommand;
import seedu.addressbook.commands.IncorrectCommand;
-import seedu.addressbook.commands.player.*;
+import seedu.addressbook.commands.player.AddCommand;
+import seedu.addressbook.commands.player.ClearCommand;
+import seedu.addressbook.commands.player.DeleteCommand;
+import seedu.addressbook.commands.player.FindCommand;
+import seedu.addressbook.commands.player.ListCommand;
+import seedu.addressbook.commands.player.ViewAllCommand;
import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.data.player.*;
+import seedu.addressbook.data.player.Age;
+import seedu.addressbook.data.player.Appearance;
+import seedu.addressbook.data.player.Country;
+import seedu.addressbook.data.player.GoalsAssisted;
+import seedu.addressbook.data.player.GoalsScored;
+import seedu.addressbook.data.player.HealthStatus;
+import seedu.addressbook.data.player.JerseyNumber;
+import seedu.addressbook.data.player.Name;
+import seedu.addressbook.data.player.Player;
+import seedu.addressbook.data.player.PositionPlayed;
+import seedu.addressbook.data.player.ReadOnlyPlayer;
+import seedu.addressbook.data.player.Salary;
+import seedu.addressbook.data.player.Team;
import seedu.addressbook.data.tag.Tag;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static seedu.addressbook.common.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
-
public class ParserTest {
private Parser parser;
@@ -30,7 +48,7 @@ public void setup() {
@Test
public void emptyInput_returnsIncorrect() {
- final String[] emptyInputs = { "", " ", "\n \n" };
+ final String[] emptyInputs = {"", " ", "\n \n"};
final String resultMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE);
parseAndAssertIncorrectWithMessage(resultMessage, emptyInputs);
}
@@ -73,14 +91,14 @@ public void exitCommand_parsedCorrectly() {
*/
@Test
public void deleteCommand_noArgs() {
- final String[] inputs = { "delete", "delete " };
+ final String[] inputs = {"delete", "delete "};
final String resultMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE);
parseAndAssertIncorrectWithMessage(resultMessage, inputs);
}
@Test
public void deleteCommand_argsIsNotSingleNumber() {
- final String[] inputs = { "delete notANumber ", "delete 8*wh12", "delete 1 2 3 4 5" };
+ final String[] inputs = {"delete notANumber ", "delete 8*wh12", "delete 1 2 3 4 5"};
final String resultMessage;
resultMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE);
parseAndAssertIncorrectWithMessage(resultMessage, inputs);
@@ -96,7 +114,7 @@ public void deleteCommand_numericArg_indexParsedCorrectly() {
@Test
public void viewAllCommand_noArgs() {
- final String[] inputs = { "viewall", "viewall " };
+ final String[] inputs = {"viewall", "viewall "};
final String resultMessage =
String.format(MESSAGE_INVALID_COMMAND_FORMAT, ViewAllCommand.MESSAGE_USAGE);
parseAndAssertIncorrectWithMessage(resultMessage, inputs);
@@ -104,7 +122,7 @@ public void viewAllCommand_noArgs() {
@Test
public void viewAllCommand_argsIsNotSingleNumber() {
- final String[] inputs = { "viewall notAnumber ", "viewall 8*wh12", "viewall 1 2 3 4 5" };
+ final String[] inputs = {"viewall notAnumber ", "viewall 8*wh12", "viewall 1 2 3 4 5"};
final String resultMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, ViewAllCommand.MESSAGE_USAGE);
parseAndAssertIncorrectWithMessage(resultMessage, inputs);
}
@@ -125,8 +143,8 @@ public void viewAllCommand_numericArg_indexParsedCorrectly() {
public void findCommand_invalidArgs() {
// no keywords
final String[] inputs = {
- "find",
- "find "
+ "find",
+ "find "
};
final String resultMessage =
String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_USAGE);
@@ -135,7 +153,7 @@ public void findCommand_invalidArgs() {
@Test
public void findCommand_validArgs_parsedCorrectly() {
- final String[] keywords = { "key1", "key2", "key3" };
+ final String[] keywords = {"key1", "key2", "key3"};
final Set keySet = new HashSet<>(Arrays.asList(keywords));
final String input = "find " + String.join(" ", keySet);
@@ -146,7 +164,7 @@ public void findCommand_validArgs_parsedCorrectly() {
@Test
public void findCommand_duplicateKeys_parsedCorrectly() {
- final String[] keywords = { "key1", "key2", "key3" };
+ final String[] keywords = {"key1", "key2", "key3"};
final Set keySet = new HashSet<>(Arrays.asList(keywords));
// duplicate every keyword
@@ -162,58 +180,68 @@ public void findCommand_duplicateKeys_parsedCorrectly() {
@Test
public void addCommand_invalidArgs() {
final String[] inputs = {
- "addPlayer",
- "addPlayer ",
- "addPlayer wrong args format",
+ "addPlayer",
+ "addPlayer ",
+ "addPlayer wrong args format",
// no position prefix
- String.format("addPlayer %1$s %2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s %2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
// no age prefix
- String.format("addPlayer %1$s p/%2$s %3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s p/%2$s %3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
// no salary prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s %4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s p/%2$s a/%3$s %4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
//no GoalsScored prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s %5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s %5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
//no GoalsAssisted prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s %6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s %6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
//no Team prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s %7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s %7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
//no Country prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s %8$s jn/%9$s app/%10$s hs/%11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s %8$s jn/%9$s app/%10$s hs/%11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
//no JerseyNumber prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s %9$s app/%10$s hs/%11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s %9$s app/%10$s hs/%11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
//no Appearance prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s %10$s hs/%11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s %10$s hs/%11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
//no HealthStatus prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s %11$s", Name.EXAMPLE,
- PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE,GoalsScored.EXAMPLE,GoalsAssisted.EXAMPLE,
- Team.EXAMPLE,Country.EXAMPLE, JerseyNumber.EXAMPLE,Appearance.EXAMPLE,HealthStatus.EXAMPLE),
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s %11$s",
+ Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
+ HealthStatus.EXAMPLE),
};
final String resultMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE);
parseAndAssertIncorrectWithMessage(resultMessage, inputs);
@@ -226,44 +254,52 @@ public void addCommand_invalidPlayerDataInArgs() {
final String invalidName = "[]\\[;]";
final String validName = Name.EXAMPLE; //name
final String invalidAgeArg = "a/not_numbers";
- final String validAgeArg = "a/"+ Age.EXAMPLE; //age
+ final String validAgeArg = "a/" + Age.EXAMPLE; //age
final String invalidSalaryArg = "sal/not_number";
- final String validSalaryArg = "sal/"+ Salary.EXAMPLE; //salary
+ final String validSalaryArg = "sal/" + Salary.EXAMPLE; //salary
final String invalidGSArg = "gs/not_number";
- final String validGSArg = "gs/"+ GoalsScored.EXAMPLE; //gs
+ final String validGSArg = "gs/" + GoalsScored.EXAMPLE; //gs
final String invalidGAArg = "ga/not_number";
- final String validGAArg = "ga/"+ GoalsAssisted.EXAMPLE; //ga
+ final String validGAArg = "ga/" + GoalsAssisted.EXAMPLE; //ga
final String invalidJNArg = "jn/not_number";
- final String validJNArg = "jn/"+ JerseyNumber.EXAMPLE;
+ final String validJNArg = "jn/" + JerseyNumber.EXAMPLE;
final String invalidAppearanceArg = "app/not_number";
- final String validAppearanceArg = "app/"+Appearance.EXAMPLE;
+ final String validAppearanceArg = "app/" + Appearance.EXAMPLE;
final String invalidTagArg = "t/invalid_-[.tag";
// PositionPlayer, Team, Country and HealthStatus can be any string, so no invalid address
// name, age, salary, gs, ga, jn, app
- final String addCommandFormatString = "addPlayer %1$s "+ "p/"+PositionPlayed.EXAMPLE +" %2$s %3$s %4$s %5$s " +"tm/"+
- Team.EXAMPLE + " ctry/"+ Country.EXAMPLE + " %6$s %7$s " +"hs/"+HealthStatus.EXAMPLE+ " ";
+ final String addCommandFormatString = "addPlayer %1$s " + "p/" + PositionPlayed.EXAMPLE + " %2$s %3$s %4$s %5$s " + "tm/" +
+ Team.EXAMPLE + " ctry/" + Country.EXAMPLE + " %6$s %7$s " + "hs/" + HealthStatus.EXAMPLE + " ";
// test each incorrect player data field argument individually
final String[] inputs = {
// invalid name
- String.format(addCommandFormatString, invalidName, validAgeArg, validSalaryArg,validGSArg,validGAArg,validJNArg,validAppearanceArg),
+ String.format(addCommandFormatString, invalidName, validAgeArg, validSalaryArg, validGSArg,
+ validGAArg, validJNArg, validAppearanceArg),
// invalid age
- String.format(addCommandFormatString, validName, invalidAgeArg, validSalaryArg,validGSArg,validGAArg,validJNArg,validAppearanceArg),
+ String.format(addCommandFormatString, validName, invalidAgeArg, validSalaryArg, validGSArg,
+ validGAArg, validJNArg, validAppearanceArg),
// invalid salary
- String.format(addCommandFormatString, validName, validAgeArg, invalidSalaryArg,validGSArg,validGAArg,validJNArg,validAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, invalidSalaryArg, validGSArg,
+ validGAArg, validJNArg, validAppearanceArg),
// invalid GS
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg,invalidGSArg,validGAArg,validJNArg,validAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, invalidGSArg,
+ validGAArg, validJNArg, validAppearanceArg),
// invalid GA
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg,validGSArg,invalidGAArg,validJNArg,validAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGSArg,
+ invalidGAArg, validJNArg, validAppearanceArg),
// invalid JN
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg,validGSArg,validGAArg,invalidJNArg,validAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGSArg,
+ validGAArg, invalidJNArg, validAppearanceArg),
// invalid Appearance
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg,validGSArg,validGAArg,validJNArg,invalidAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGSArg,
+ validGAArg, validJNArg, invalidAppearanceArg),
// invalid tag
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg,validGSArg,validGAArg,validJNArg,validAppearanceArg)+ " " + invalidTagArg
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGSArg,
+ validGAArg, validJNArg, validAppearanceArg) + " " + invalidTagArg
};
for (String input : inputs) {
parseAndAssertCommandType(input, IncorrectCommand.class);
@@ -298,18 +334,18 @@ public void addCommand_duplicateTags_merged() throws IllegalValueException {
private static Player generateTestPlayer() {
try {
return new Player(
- new Name(Name.EXAMPLE),
- new PositionPlayed(PositionPlayed.EXAMPLE),
- new Age(Age.EXAMPLE),
- new Salary(Salary.EXAMPLE),
- new GoalsScored(GoalsScored.EXAMPLE),
- new GoalsAssisted(GoalsAssisted.EXAMPLE),
- new Team(Team.EXAMPLE),
- new Country(Country.EXAMPLE),
- new JerseyNumber(JerseyNumber.EXAMPLE),
- new Appearance(Appearance.EXAMPLE),
- new HealthStatus(HealthStatus.EXAMPLE),
- new HashSet<>(Arrays.asList(new Tag("tag1"), new Tag("tag2"), new Tag("tag3")))
+ new Name(Name.EXAMPLE),
+ new PositionPlayed(PositionPlayed.EXAMPLE),
+ new Age(Age.EXAMPLE),
+ new Salary(Salary.EXAMPLE),
+ new GoalsScored(GoalsScored.EXAMPLE),
+ new GoalsAssisted(GoalsAssisted.EXAMPLE),
+ new Team(Team.EXAMPLE),
+ new Country(Country.EXAMPLE),
+ new JerseyNumber(JerseyNumber.EXAMPLE),
+ new Appearance(Appearance.EXAMPLE),
+ new HealthStatus(HealthStatus.EXAMPLE),
+ new HashSet<>(Arrays.asList(new Tag("tag1"), new Tag("tag2"), new Tag("tag3")))
);
} catch (IllegalValueException ive) {
throw new RuntimeException("test player data should be valid by definition");
@@ -322,16 +358,16 @@ private static Player generateTestPlayer() {
private static String convertPlayerToAddCommandString(ReadOnlyPlayer player) {
String addCommand = "addPlayer "
+ player.getName().fullName
- + " p/"+ player.getPositionPlayed().fullPosition
- + " a/"+ player.getAge().value
- + " sal/"+player.getSalary().value
- + " gs/"+player.getGoalsScored().value
- + " ga/"+player.getGoalsAssisted().value
- + " tm/"+player.getTeam().fullTeam
- + " ctry/"+player.getCountry().fullCountry
- + " jn/"+ player.getJerseyNumber().value
- + " app/"+player.getAppearance().value
- + " hs/"+player.getHealthStatus().fullHs;
+ + " p/" + player.getPositionPlayed().fullPosition
+ + " a/" + player.getAge().value
+ + " sal/" + player.getSalary().value
+ + " gs/" + player.getGoalsScored().value
+ + " ga/" + player.getGoalsAssisted().value
+ + " tm/" + player.getTeam().fullTeam
+ + " ctry/" + player.getCountry().fullCountry
+ + " jn/" + player.getJerseyNumber().value
+ + " app/" + player.getAppearance().value
+ + " hs/" + player.getHealthStatus().fullHs;
for (Tag tag : player.getTags()) {
addCommand += " t/" + tag.tagName;
}
@@ -355,7 +391,7 @@ private void parseAndAssertIncorrectWithMessage(String feedbackMessage, String..
/**
* Utility method for parsing input and asserting the class/type of the returned command object.
*
- * @param input to be parsed
+ * @param input to be parsed
* @param expectedCommandClass expected class of returned command
* @return the parsed command object
*/
From 64f2b18b1b774e7d5a0f253463d64621f5c53cbd Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 11:31:21 +0800
Subject: [PATCH 17/19] edit to pass checkstyle attempt messi
---
.../seedu/addressbook/logic/LogicTest.java | 53 ++++++----------
.../seedu/addressbook/parser/ParserTest.java | 61 +++++++++----------
.../addressbook/storage/StorageFileTest.java | 26 +++++---
3 files changed, 67 insertions(+), 73 deletions(-)
diff --git a/test/java/seedu/addressbook/logic/LogicTest.java b/test/java/seedu/addressbook/logic/LogicTest.java
index 142fb31f7..a324e4d2d 100644
--- a/test/java/seedu/addressbook/logic/LogicTest.java
+++ b/test/java/seedu/addressbook/logic/LogicTest.java
@@ -156,52 +156,62 @@ public void execute_add_invalidArgsFormat() throws Exception {
//no position prefix
assertCommandBehavior(
- "addPlayer Valid Name Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoPositionPrefix ctry/China"
+ "addPlayer Valid Name Striker a/30 sal/20000 gs/0 "
+ + "ga/0 tm/validTeam.butNoPositionPrefix ctry/China "
+ "jn/9 app/0 hs/Healthy", expectedMessage);
//no age prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker 30 sal/20000 gs/0 ga/0 tm/validTeam.butNoAgePrefix ctry/China"
+ "addPlayer Valid Name p/Striker 30 sal/20000 gs/0 "
+ + "ga/0 tm/validTeam.butNoAgePrefix ctry/China "
+ "jn/9 app/0 hs/Healthy", expectedMessage);
//no salary prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 20000 gs/0 ga/0 tm/validTeam.butNoSalaryPrefix ctry/China"
+ "addPlayer Valid Name p/Striker a/30 20000 gs/0 "
+ + "ga/0 tm/validTeam.butNoSalaryPrefix ctry/China "
+ "jn/9 app/0 hs/Healthy", expectedMessage);
//no goals scored prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 0 ga/0 tm/validTeam.butNoGoalsScoredPrefix ctry/China"
+ "addPlayer Valid Name p/Striker a/30 sal/20000 0 "
+ + "ga/0 tm/validTeam.butNoGoalsScoredPrefix ctry/China "
+ "jn/9 app/0 hs/Healthy", expectedMessage);
//no goals assisted prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 0 tm/validTeam.butNoGoalsAssistedPrefix ctry/China"
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 "
+ + "0 tm/validTeam.butNoGoalsAssistedPrefix ctry/China "
+ "jn/9 app/0 hs/Healthy", expectedMessage);
//no team prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 validTeam.butNoPrefix ctry/China"
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 "
+ + "ga/0 validTeam.butNoPrefix ctry/China "
+ "jn/9 app/0 hs/Healthy", expectedMessage);
//no country prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoCountryPrefix China"
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 "
+ + "ga/0 tm/validTeam.butNoCountryPrefix China "
+ "jn/9 app/0 hs/Healthy", expectedMessage);
//no jersey number prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoJerseyNumberPrefix ctry/China"
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 "
+ + "ga/0 tm/validTeam.butNoJerseyNumberPrefix ctry/China "
+ "9 app/0 hs/Healthy", expectedMessage);
//no appearance prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoAppearancePrefix ctry/China"
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 "
+ + "ga/0 tm/validTeam.butNoAppearancePrefix ctry/China "
+ "jn/9 0 hs/Healthy", expectedMessage);
//no health status prefix
assertCommandBehavior(
- "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 ga/0 tm/validTeam.butNoHealthStatusPrefix ctry/China"
+ "addPlayer Valid Name p/Striker a/30 sal/20000 gs/0 "
+ + "ga/0 tm/validTeam.butNoHealthStatusPrefix ctry/China "
+ "jn/9 app/0 Healthy", expectedMessage);
}
@@ -244,8 +254,6 @@ public void execute_add_invalidPlayerData() throws Exception {
assertCommandBehavior(
"addPlayer Valid Name p/Striker a/thirty sal/20000 gs/0 ga/0 tm/validTeam ctry/China "
+ "jn/9 app/0 hs/Healthy", Age.MESSAGE_AGE_CONSTRAINTS);
-// assertCommandBehavior(
-// "addPlayer Valid Name p/Striker a/800 sal/20000 gs/0 ga/0 tm/validTeam ctry/China jn/9 app/0 hs/Healthy", Age.MESSAGE_AGE_CONSTRAINTS);
assertCommandBehavior(
"addPlayer Valid Name p/Striker a/30 sal/zero gs/0 ga/0 tm/validTeam ctry/China "
+ "jn/9 app/0 hs/Healthy", Salary.MESSAGE_SALARY_CONSTRAINTS);
@@ -343,27 +351,6 @@ private void assertInvalidIndexBehaviorForCommand(String commandWord) throws Exc
assertCommandBehavior(commandWord + " 3", expectedMessage, AddressBook.empty(), false, lastPlayerList);
}
-
-// @Test
-// public void execute_tryToViewMissingPerson_errorMessage() throws Exception {
-// TestDataHelper helper = new TestDataHelper();
-// Player p1 = helper.generatePlayer(1);
-// Player p2 = helper.generatePlayer(2);
-// List lastPlayerList = helper.generatePlayerList(p1, p2);
-//
-// AddressBook expectedAb = new AddressBook();
-// expectedAb.addPlayer(p2);
-//
-// addressBook.addPlayer(p2);
-// logic.setLastPlayerShownList(lastPlayerList);
-//
-// assertCommandBehavior("view 1",
-// Messages.MESSAGE_PLAYER_NOT_IN_LEAGUE,
-// expectedAb,
-// false,
-// lastPlayerList);
-// }
-
@Test
public void execute_viewAll_invalidArgsFormat() throws Exception {
String expectedMessage = String.format(MESSAGE_INVALID_COMMAND_FORMAT, ViewAllCommand.MESSAGE_USAGE);
diff --git a/test/java/seedu/addressbook/parser/ParserTest.java b/test/java/seedu/addressbook/parser/ParserTest.java
index b835fc552..0513356f3 100644
--- a/test/java/seedu/addressbook/parser/ParserTest.java
+++ b/test/java/seedu/addressbook/parser/ParserTest.java
@@ -142,10 +142,7 @@ public void viewAllCommand_numericArg_indexParsedCorrectly() {
@Test
public void findCommand_invalidArgs() {
// no keywords
- final String[] inputs = {
- "find",
- "find "
- };
+ final String[] inputs = {"find", "find "};
final String resultMessage =
String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_USAGE);
parseAndAssertIncorrectWithMessage(resultMessage, inputs);
@@ -179,10 +176,7 @@ public void findCommand_duplicateKeys_parsedCorrectly() {
*/
@Test
public void addCommand_invalidArgs() {
- final String[] inputs = {
- "addPlayer",
- "addPlayer ",
- "addPlayer wrong args format",
+ final String[] inputs = {"addPlayer", "addPlayer ", "addPlayer wrong args format",
// no position prefix
String.format("addPlayer %1$s %2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
@@ -250,19 +244,18 @@ public void addCommand_invalidArgs() {
@Test
public void addCommand_invalidPlayerDataInArgs() {
// name, age, salary, gs, ga, jn and appearance are the ones that need to be tested
-
final String invalidName = "[]\\[;]";
final String validName = Name.EXAMPLE; //name
final String invalidAgeArg = "a/not_numbers";
final String validAgeArg = "a/" + Age.EXAMPLE; //age
final String invalidSalaryArg = "sal/not_number";
final String validSalaryArg = "sal/" + Salary.EXAMPLE; //salary
- final String invalidGSArg = "gs/not_number";
- final String validGSArg = "gs/" + GoalsScored.EXAMPLE; //gs
- final String invalidGAArg = "ga/not_number";
- final String validGAArg = "ga/" + GoalsAssisted.EXAMPLE; //ga
- final String invalidJNArg = "jn/not_number";
- final String validJNArg = "jn/" + JerseyNumber.EXAMPLE;
+ final String invalidGsArg = "gs/not_number";
+ final String validGsArg = "gs/" + GoalsScored.EXAMPLE; //gs
+ final String invalidGaArg = "ga/not_number";
+ final String validGaArg = "ga/" + GoalsAssisted.EXAMPLE; //ga
+ final String invalidJnArg = "jn/not_number";
+ final String validJnArg = "jn/" + JerseyNumber.EXAMPLE;
final String invalidAppearanceArg = "app/not_number";
final String validAppearanceArg = "app/" + Appearance.EXAMPLE;
@@ -271,35 +264,37 @@ public void addCommand_invalidPlayerDataInArgs() {
// PositionPlayer, Team, Country and HealthStatus can be any string, so no invalid address
// name, age, salary, gs, ga, jn, app
- final String addCommandFormatString = "addPlayer %1$s " + "p/" + PositionPlayed.EXAMPLE + " %2$s %3$s %4$s %5$s " + "tm/" +
- Team.EXAMPLE + " ctry/" + Country.EXAMPLE + " %6$s %7$s " + "hs/" + HealthStatus.EXAMPLE + " ";
+ final String addCommandFormatString = "addPlayer %1$s " + "p/"
+ + PositionPlayed.EXAMPLE + " %2$s %3$s %4$s %5$s " + "tm/"
+ + Team.EXAMPLE + " ctry/" + Country.EXAMPLE + " %6$s %7$s " + "hs/"
+ + HealthStatus.EXAMPLE + " ";
// test each incorrect player data field argument individually
final String[] inputs = {
// invalid name
- String.format(addCommandFormatString, invalidName, validAgeArg, validSalaryArg, validGSArg,
- validGAArg, validJNArg, validAppearanceArg),
+ String.format(addCommandFormatString, invalidName, validAgeArg, validSalaryArg, validGsArg,
+ validGaArg, validJnArg, validAppearanceArg),
// invalid age
- String.format(addCommandFormatString, validName, invalidAgeArg, validSalaryArg, validGSArg,
- validGAArg, validJNArg, validAppearanceArg),
+ String.format(addCommandFormatString, validName, invalidAgeArg, validSalaryArg, validGsArg,
+ validGaArg, validJnArg, validAppearanceArg),
// invalid salary
- String.format(addCommandFormatString, validName, validAgeArg, invalidSalaryArg, validGSArg,
- validGAArg, validJNArg, validAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, invalidSalaryArg, validGsArg,
+ validGaArg, validJnArg, validAppearanceArg),
// invalid GS
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, invalidGSArg,
- validGAArg, validJNArg, validAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, invalidGsArg,
+ validGaArg, validJnArg, validAppearanceArg),
// invalid GA
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGSArg,
- invalidGAArg, validJNArg, validAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGsArg,
+ invalidGaArg, validJnArg, validAppearanceArg),
// invalid JN
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGSArg,
- validGAArg, invalidJNArg, validAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGsArg,
+ validGaArg, invalidJnArg, validAppearanceArg),
// invalid Appearance
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGSArg,
- validGAArg, validJNArg, invalidAppearanceArg),
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGsArg,
+ validGaArg, validJnArg, invalidAppearanceArg),
// invalid tag
- String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGSArg,
- validGAArg, validJNArg, validAppearanceArg) + " " + invalidTagArg
+ String.format(addCommandFormatString, validName, validAgeArg, validSalaryArg, validGsArg,
+ validGaArg, validJnArg, validAppearanceArg) + " " + invalidTagArg
};
for (String input : inputs) {
parseAndAssertCommandType(input, IncorrectCommand.class);
diff --git a/test/java/seedu/addressbook/storage/StorageFileTest.java b/test/java/seedu/addressbook/storage/StorageFileTest.java
index 93c4679bf..daf290385 100644
--- a/test/java/seedu/addressbook/storage/StorageFileTest.java
+++ b/test/java/seedu/addressbook/storage/StorageFileTest.java
@@ -1,20 +1,32 @@
package seedu.addressbook.storage;
+import static org.junit.Assert.assertEquals;
+import static seedu.addressbook.util.TestUtil.assertTextFilesEqual;
+
+import java.nio.file.Paths;
+import java.util.Collections;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
+
import seedu.addressbook.data.AddressBook;
import seedu.addressbook.data.exception.IllegalValueException;
-import seedu.addressbook.data.player.*;
+import seedu.addressbook.data.player.Age;
+import seedu.addressbook.data.player.Appearance;
+import seedu.addressbook.data.player.Country;
+import seedu.addressbook.data.player.GoalsAssisted;
+import seedu.addressbook.data.player.GoalsScored;
+import seedu.addressbook.data.player.HealthStatus;
+import seedu.addressbook.data.player.JerseyNumber;
+import seedu.addressbook.data.player.Name;
+import seedu.addressbook.data.player.Player;
+import seedu.addressbook.data.player.PositionPlayed;
+import seedu.addressbook.data.player.Salary;
+import seedu.addressbook.data.player.Team;
import seedu.addressbook.storage.StorageFile.StorageOperationException;
-import java.nio.file.Paths;
-import java.util.Collections;
-
-import static org.junit.Assert.assertEquals;
-import static seedu.addressbook.util.TestUtil.assertTextFilesEqual;
-
public class StorageFileTest {
private static final String TEST_DATA_FOLDER = "test/data/StorageFileTest";
From d8e8e25afe6e8bd24f3a899a4165c7079e881bc2 Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 11:40:22 +0800
Subject: [PATCH 18/19] edit to pass checkstyle attempt 11
---
.../seedu/addressbook/parser/ParserTest.java | 32 ++++++++++++-------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/test/java/seedu/addressbook/parser/ParserTest.java b/test/java/seedu/addressbook/parser/ParserTest.java
index 0513356f3..a181f0c04 100644
--- a/test/java/seedu/addressbook/parser/ParserTest.java
+++ b/test/java/seedu/addressbook/parser/ParserTest.java
@@ -178,61 +178,71 @@ public void findCommand_duplicateKeys_parsedCorrectly() {
public void addCommand_invalidArgs() {
final String[] inputs = {"addPlayer", "addPlayer ", "addPlayer wrong args format",
// no position prefix
- String.format("addPlayer %1$s %2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ String.format("addPlayer %1$s %2$s a/%3$s sal/%4$s gs/%5$s "
+ + "ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
// no age prefix
- String.format("addPlayer %1$s p/%2$s %3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ String.format("addPlayer %1$s p/%2$s %3$s sal/%4$s gs/%5$s "
+ + "ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
// no salary prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s %4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ String.format("addPlayer %1$s p/%2$s a/%3$s %4$s gs/%5$s "
+ + "ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
//no GoalsScored prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s %5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s %5$s "
+ + "ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
//no GoalsAssisted prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s %6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s "
+ + "%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
//no Team prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s %7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s "
+ + "ga/%6$s %7$s ctry/%8$s jn/%9$s app/%10$s hs/%11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
//no Country prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s %8$s jn/%9$s app/%10$s hs/%11$s",
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s "
+ + "ga/%6$s tm/%7$s %8$s jn/%9$s app/%10$s hs/%11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
//no JerseyNumber prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s %9$s app/%10$s hs/%11$s",
- Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s "
+ + "ga/%6$s tm/%7$s ctry/%8$s %9$s app/%10$s hs/%11$s", Name.EXAMPLE,
+ PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
//no Appearance prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s %10$s hs/%11$s",
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s "
+ + "ga/%6$s tm/%7$s ctry/%8$s jn/%9$s %10$s hs/%11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
//no HealthStatus prefix
- String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s %11$s",
+ String.format("addPlayer %1$s p/%2$s a/%3$s sal/%4$s gs/%5$s "
+ + "ga/%6$s tm/%7$s ctry/%8$s jn/%9$s app/%10$s %11$s",
Name.EXAMPLE, PositionPlayed.EXAMPLE, Age.EXAMPLE, Salary.EXAMPLE, GoalsScored.EXAMPLE,
GoalsAssisted.EXAMPLE, Team.EXAMPLE, Country.EXAMPLE, JerseyNumber.EXAMPLE, Appearance.EXAMPLE,
HealthStatus.EXAMPLE),
From 62217d156222ed6b307abc8ed34946625fe9d07e Mon Sep 17 00:00:00 2001
From: warheade <[wangjiannan124@live.com]>
Date: Sat, 30 Mar 2019 11:47:57 +0800
Subject: [PATCH 19/19] edit to pass checkstyle attempt 12
---
test/java/seedu/addressbook/parser/ParserTest.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/java/seedu/addressbook/parser/ParserTest.java b/test/java/seedu/addressbook/parser/ParserTest.java
index a181f0c04..95c1e95ed 100644
--- a/test/java/seedu/addressbook/parser/ParserTest.java
+++ b/test/java/seedu/addressbook/parser/ParserTest.java
@@ -255,15 +255,15 @@ public void addCommand_invalidArgs() {
public void addCommand_invalidPlayerDataInArgs() {
// name, age, salary, gs, ga, jn and appearance are the ones that need to be tested
final String invalidName = "[]\\[;]";
- final String validName = Name.EXAMPLE; //name
+ final String validName = Name.EXAMPLE;
final String invalidAgeArg = "a/not_numbers";
- final String validAgeArg = "a/" + Age.EXAMPLE; //age
+ final String validAgeArg = "a/" + Age.EXAMPLE;
final String invalidSalaryArg = "sal/not_number";
- final String validSalaryArg = "sal/" + Salary.EXAMPLE; //salary
+ final String validSalaryArg = "sal/" + Salary.EXAMPLE;
final String invalidGsArg = "gs/not_number";
- final String validGsArg = "gs/" + GoalsScored.EXAMPLE; //gs
+ final String validGsArg = "gs/" + GoalsScored.EXAMPLE;
final String invalidGaArg = "ga/not_number";
- final String validGaArg = "ga/" + GoalsAssisted.EXAMPLE; //ga
+ final String validGaArg = "ga/" + GoalsAssisted.EXAMPLE;
final String invalidJnArg = "jn/not_number";
final String validJnArg = "jn/" + JerseyNumber.EXAMPLE;
final String invalidAppearanceArg = "app/not_number";