Skip to content

Commit f63b914

Browse files
authored
Merge pull request #77 from bryans17/branch-improveTests
Add Tests
2 parents 4254b0d + c3c006c commit f63b914

File tree

98 files changed

+1250
-506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1250
-506
lines changed

src/main/java/seedu/address/commons/core/LogsCenter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* Configures and manages loggers and handlers, including their logging level
1313
* Named {@link Logger}s can be obtained from this class<br>
1414
* These loggers have been configured to output messages to the console and a {@code .log} file by default,
15-
* at the {@code INFO} level. A new {@code .log} file with a new numbering will be created after the log
16-
* file reaches 5MB big, up to a maximum of 5 files.<br>
15+
* at the {@code INFO} level. A new {@code .log} file with a new numbering will be created after the log
16+
* file reaches 5MB big, up to a maximum of 5 files.<br>
1717
*/
1818
public class LogsCenter {
1919
private static final int MAX_FILE_COUNT = 5;
@@ -95,6 +95,7 @@ private static void addFileHandler(Logger logger) {
9595

9696
/**
9797
* Creates a {@code FileHandler} for the log file.
98+
*
9899
* @throws IOException if there are problems opening the file.
99100
*/
100101
private static FileHandler createFileHandler() throws IOException {

src/main/java/seedu/address/commons/core/Version.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public boolean isEarlyAccess() {
5050

5151
/**
5252
* Parses a version number string in the format V1.2.3.
53+
*
5354
* @param versionString version number string
5455
* @return a Version object
5556
*/

src/main/java/seedu/address/commons/util/CollectionUtil.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
*/
1313
public class CollectionUtil {
1414

15-
/** @see #requireAllNonNull(Collection) */
15+
/**
16+
* @see #requireAllNonNull(Collection)
17+
*/
1618
public static void requireAllNonNull(Object... items) {
1719
requireNonNull(items);
1820
Stream.of(items).forEach(Objects::requireNonNull);

src/main/java/seedu/address/commons/util/FileUtil.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static boolean isFileExists(Path file) {
2020
/**
2121
* Returns true if {@code path} can be converted into a {@code Path} via {@link Paths#get(String)},
2222
* otherwise returns false.
23+
*
2324
* @param path A string representing the file path. Cannot be null.
2425
*/
2526
public static boolean isValidPath(String path) {
@@ -33,6 +34,7 @@ public static boolean isValidPath(String path) {
3334

3435
/**
3536
* Creates a file if it does not exist along with its missing parent directories.
37+
*
3638
* @throws IOException if the file or directory cannot be created.
3739
*/
3840
public static void createIfMissing(Path file) throws IOException {

src/main/java/seedu/address/commons/util/JsonUtil.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static <T> T deserializeObjectFromJsonFile(Path jsonFile, Class<T> classOfObject
5151
/**
5252
* Returns the Json object from the given file or {@code Optional.empty()} object if the file is not found.
5353
* If any values are missing from the file, default values will be used, as long as the file is a valid json file.
54+
*
5455
* @param filePath cannot be null.
5556
* @param classOfObjectToDeserialize Json file has to correspond to the structure in the class given here.
5657
* @throws DataConversionException if the file format is not as expected.
@@ -79,6 +80,7 @@ public static <T> Optional<T> readJsonFile(
7980
/**
8081
* Saves the Json object to the specified file.
8182
* Overwrites existing file if it exists, creates a new file if it doesn't.
83+
*
8284
* @param jsonFile cannot be null
8385
* @param filePath cannot be null
8486
* @throws IOException if there was an error during writing to the file
@@ -93,6 +95,7 @@ public static <T> void saveJsonFile(T jsonFile, Path filePath) throws IOExceptio
9395

9496
/**
9597
* Converts a given string representation of a JSON data to instance of a class
98+
*
9699
* @param <T> The generic type to create an instance of
97100
* @return The instance of T with the specified values in the JSON string
98101
*/
@@ -102,6 +105,7 @@ public static <T> T fromJsonString(String json, Class<T> instanceClass) throws I
102105

103106
/**
104107
* Converts a given instance of a class into its JSON data string representation
108+
*
105109
* @param instance The T object to be converted into the JSON string
106110
* @param <T> The generic type to create an instance of
107111
* @return JSON data representation of the given class instance, in string
@@ -128,7 +132,6 @@ protected Level _deserialize(String value, DeserializationContext ctxt) {
128132
* Gets the logging level that matches loggingLevelString
129133
* <p>
130134
* Returns null if there are no matches
131-
*
132135
*/
133136
private Level getLoggingLevel(String loggingLevelString) {
134137
return Level.parse(loggingLevelString);

src/main/java/seedu/address/commons/util/StringUtil.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ public class StringUtil {
1414

1515
/**
1616
* Returns true if the {@code sentence} contains the {@code word}.
17-
* Ignores case, but a full word match is required.
18-
* <br>examples:<pre>
17+
* Ignores case, but a full word match is required.
18+
* <br>examples:<pre>
1919
* containsWordIgnoreCase("ABc def", "abc") == true
2020
* containsWordIgnoreCase("ABc def", "DEF") == true
2121
* containsWordIgnoreCase("ABc def", "AB") == false //not a full word match
2222
* </pre>
23+
*
2324
* @param sentence cannot be null
2425
* @param word cannot be null, cannot be empty, must be a single word
2526
*/
@@ -53,6 +54,7 @@ public static String getDetails(Throwable t) {
5354
* e.g. 1, 2, 3, ..., {@code Integer.MAX_VALUE} <br>
5455
* Will return false for any other non-null string input
5556
* e.g. empty string, "-1", "0", "+1", and " 2 " (untrimmed), "3 0" (contains whitespace), "1 a" (contains letters)
57+
*
5658
* @throws NullPointerException if {@code s} is null.
5759
*/
5860
public static boolean isNonZeroUnsignedInteger(String s) {

src/main/java/seedu/address/logic/Logic.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
public interface Logic {
1717
/**
1818
* Executes the command and returns the result.
19+
*
1920
* @param commandText The command as entered by the user.
2021
* @return the result of the command execution.
2122
* @throws CommandException If an error occurs during command execution.
@@ -30,7 +31,9 @@ public interface Logic {
3031
*/
3132
ReadOnlyAddressBook getAddressBook();
3233

33-
/** Returns an unmodifiable view of the filtered list of persons */
34+
/**
35+
* Returns an unmodifiable view of the filtered list of persons
36+
*/
3437
ObservableList<Student> getFilteredStudentList();
3538

3639
/**

src/main/java/seedu/address/logic/commands/AddCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
import seedu.address.logic.commands.exceptions.CommandException;
1212
import seedu.address.model.Model;
13+
import seedu.address.model.lab.Lab;
14+
import seedu.address.model.lab.LabList;
1315
import seedu.address.model.student.Student;
14-
import seedu.address.model.student.lab.Lab;
15-
import seedu.address.model.student.lab.LabList;
1616

1717
/**
1818
* Adds a Student to the TAddressBook.

src/main/java/seedu/address/logic/commands/AddLabCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import seedu.address.logic.commands.exceptions.CommandException;
88
import seedu.address.model.Model;
9-
import seedu.address.model.student.lab.Lab;
9+
import seedu.address.model.lab.Lab;
1010

1111
/**
1212
* Adds a Lab to the TAddressBook.
@@ -44,7 +44,7 @@ public CommandResult execute(Model model) throws CommandException {
4444

4545
model.addLab(toAdd);
4646
model.updateFilteredStudentList(PREDICATE_SHOW_ALL_STUDENTS);
47-
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
47+
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd.labNumber));
4848
}
4949

5050
@Override

src/main/java/seedu/address/logic/commands/CommandResult.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ public class CommandResult {
1111

1212
private final String feedbackToUser;
1313

14-
/** Help information should be shown to the user. */
14+
/**
15+
* Help information should be shown to the user.
16+
*/
1517
private final boolean showHelp;
1618

17-
/** The application should exit. */
19+
/**
20+
* The application should exit.
21+
*/
1822
private final boolean exit;
1923

2024
/**

0 commit comments

Comments
 (0)