Skip to content

Commit 65b6518

Browse files
authored
Merge pull request #2 from tensaida/branch-A-Assertions
Add assertions
2 parents 7836de3 + f2b8106 commit 65b6518

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ application {
4747
}
4848

4949
shadowJar {
50-
archiveBaseName = "duke"
50+
archiveBaseName = "drake"
5151
archiveClassifier = null
5252
}
5353

54-
run{
54+
run {
5555
standardInput = System.in
56+
enableAssertions = true
5657
}
5758

5859
checkstyle {

data/tasks.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ D;yo;X;2020-02-02
22
T;andre;
33
T;commit to github;
44
T;haha;
5+
D;im done; ;1999-10-10

src/main/java/drake/commands/DeadlineCommand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class DeadlineCommand extends CreateTaskCommand {
2828
*/
2929
public DeadlineCommand(String fullInput) {
3030
super(fullInput);
31+
assert fullInput.startsWith("deadline");
3132
}
3233

3334
/**

src/main/java/drake/commands/EventCommand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class EventCommand extends CreateTaskCommand {
2727
*/
2828
public EventCommand(String fullInput) {
2929
super(fullInput);
30+
assert fullInput.startsWith("event");
3031
}
3132

3233
/**

src/main/java/drake/tasks/Deadline.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
import java.util.ArrayList;
66
import java.util.List;
77

8+
/**
9+
* Represents a deadline task.
10+
*/
811
public class Deadline extends Task {
912

1013
protected final LocalDate by;
1114

15+
/**
16+
* Constructor.
17+
* @param description The task description.
18+
* @param by The deadline of the task.
19+
*/
1220
public Deadline(String description, String by) {
1321
super(description);
1422
this.by = LocalDate.parse(by);
@@ -27,4 +35,4 @@ public List<String> toList() {
2735
public String toString() {
2836
return "[D]" + super.toString() + " (by: " + by.format(DateTimeFormatter.ofPattern("dd MMM yyyy")) + ")";
2937
}
30-
}
38+
}

0 commit comments

Comments
 (0)