Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into branch-A-CodeQuality
Browse files Browse the repository at this point in the history
  • Loading branch information
icantshootfloorballs committed Sep 12, 2024
2 parents 350c25a + 8ec2fab commit 64547f7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/java/devon/Devon.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ private String deadlineAction(String input) throws DevonInvalidDeadlineException
String description = contents[0];
String by = contents[1];

assert description != null && !description.isEmpty() : "Deadline description cannot be empty.";
assert by != null && !by.isEmpty() : "Deadline date cannot be empty.";

try {
LocalDateTime byDateTime = LocalDateTime.parse(by, Storage.DATE_TIME_FORMATTER_FOR_EXTERNAL_INPUT);
return addToList(new Deadline(description, byDateTime));
Expand All @@ -189,6 +192,10 @@ private String eventAction(String input) throws DevonInvalidEventException, Devo
String from = contents[1];
String to = contents[2];

assert description != null && !description.isEmpty() : "Event description cannot be empty.";
assert from != null && !from.isEmpty() : "Event start time cannot be empty.";
assert to != null && !to.isEmpty() : "Event end time cannot be empty.";

try {
LocalDateTime fromDateTime = LocalDateTime.parse(from, Storage.DATE_TIME_FORMATTER_FOR_EXTERNAL_INPUT);
LocalDateTime toDateTime = LocalDateTime.parse(to, Storage.DATE_TIME_FORMATTER_FOR_EXTERNAL_INPUT);
Expand Down Expand Up @@ -251,9 +258,9 @@ private void unknownAction() throws DevonUnknownCommandException {
private String addToList(Task task) {
tasks.addTask(task);
return "\t" + "Got it. I've added this task:\n\t\t"
+ task + "\n\tNow you have "
+ tasks.getNumberOfTasks()
+ " tasks in the list.";
+ task + "\n\tNow you have "
+ tasks.getNumberOfTasks()
+ " tasks in the list.";
}

/**
Expand Down

0 comments on commit 64547f7

Please sign in to comment.