Skip to content

Commit

Permalink
add assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktohzyu committed Sep 9, 2020
1 parent 0177fda commit 0a4bb48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ public class Duke {
*/
public static void main(String[] args) throws DukeException {
TaskList tasks = Storage.read();
assert tasks != null : "error initializing tasks";
UI ui = new UI();
assert ui != null : "error initializing UI";
ui.welcome(tasks);
String input = ui.getInput();
Parser parser = new Parser(tasks);
assert ui != null : "error initializing parser";
while (!input.equals("bye")) {
try {
if (input.isEmpty()) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public Parser(TaskList tasks) {
* @throws DukeException
*/
void parse(String input) throws DukeException {
assert !input.isEmpty() : "error: input is null";
String[] words = input.split(" ");
String command = words[0];
Task newTask;
Expand Down

0 comments on commit 0a4bb48

Please sign in to comment.