diff --git a/lib/apiguardian-api-1.0.0.jar b/lib/apiguardian-api-1.0.0.jar new file mode 100644 index 0000000000..6cbff70f22 Binary files /dev/null and b/lib/apiguardian-api-1.0.0.jar differ diff --git a/lib/bsh-2.0b6.jar b/lib/bsh-2.0b6.jar new file mode 100644 index 0000000000..29d71a9d58 Binary files /dev/null and b/lib/bsh-2.0b6.jar differ diff --git a/lib/jcommander-1.72.jar b/lib/jcommander-1.72.jar new file mode 100644 index 0000000000..acb8e609b1 Binary files /dev/null and b/lib/jcommander-1.72.jar differ diff --git a/lib/junit-jupiter-5.4.2.jar b/lib/junit-jupiter-5.4.2.jar new file mode 100644 index 0000000000..b3bf697621 Binary files /dev/null and b/lib/junit-jupiter-5.4.2.jar differ diff --git a/lib/junit-jupiter-api-5.4.2.jar b/lib/junit-jupiter-api-5.4.2.jar new file mode 100644 index 0000000000..40828b7a90 Binary files /dev/null and b/lib/junit-jupiter-api-5.4.2.jar differ diff --git a/lib/junit-jupiter-engine-5.4.2.jar b/lib/junit-jupiter-engine-5.4.2.jar new file mode 100644 index 0000000000..3444a9806a Binary files /dev/null and b/lib/junit-jupiter-engine-5.4.2.jar differ diff --git a/lib/junit-jupiter-params-5.4.2.jar b/lib/junit-jupiter-params-5.4.2.jar new file mode 100644 index 0000000000..ee5650412e Binary files /dev/null and b/lib/junit-jupiter-params-5.4.2.jar differ diff --git a/lib/junit-platform-commons-1.4.2.jar b/lib/junit-platform-commons-1.4.2.jar new file mode 100644 index 0000000000..270552518e Binary files /dev/null and b/lib/junit-platform-commons-1.4.2.jar differ diff --git a/lib/junit-platform-engine-1.4.2.jar b/lib/junit-platform-engine-1.4.2.jar new file mode 100644 index 0000000000..2c46ae92d3 Binary files /dev/null and b/lib/junit-platform-engine-1.4.2.jar differ diff --git a/lib/opentest4j-1.1.1.jar b/lib/opentest4j-1.1.1.jar new file mode 100644 index 0000000000..3f355292e0 Binary files /dev/null and b/lib/opentest4j-1.1.1.jar differ diff --git a/lib/testng-6.14.3.jar b/lib/testng-6.14.3.jar new file mode 100644 index 0000000000..5af78d84af Binary files /dev/null and b/lib/testng-6.14.3.jar differ diff --git a/src/main/java/duke/entity/command/Command.java b/src/main/java/duke/entity/command/Command.java index f9435f0d8c..cd59f236a5 100644 --- a/src/main/java/duke/entity/command/Command.java +++ b/src/main/java/duke/entity/command/Command.java @@ -6,6 +6,7 @@ public abstract class Command { + /** * Executes the task based on the eventual type * diff --git a/src/main/java/test/java/duke/entity/task/DeadlineTest.java b/src/main/java/test/java/duke/entity/task/DeadlineTest.java new file mode 100644 index 0000000000..b5d92f7173 --- /dev/null +++ b/src/main/java/test/java/duke/entity/task/DeadlineTest.java @@ -0,0 +1,14 @@ +package test.java.duke.entity.task; + +import duke.entity.task.Deadline; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class DeadlineTest { + + @Test + void printTask_withDateTimeFormatChange_success() { + assertEquals(new Deadline("do homework", "2020-02-10 19:00").printTask(), "[D][\u2718] do homework (by: Mon, 10 Feb 2020 07:00 PM)"); + } +} \ No newline at end of file diff --git a/src/main/java/test/java/duke/parser/CommandParserTest.java b/src/main/java/test/java/duke/parser/CommandParserTest.java new file mode 100644 index 0000000000..05f550d72a --- /dev/null +++ b/src/main/java/test/java/duke/parser/CommandParserTest.java @@ -0,0 +1,19 @@ +package test.java.duke.parser; + +import duke.entity.command.AddCommand; +import duke.entity.task.Event; +import duke.entity.task.Todo; +import duke.handler.Ui; +import duke.parser.CommandParser; +import org.testng.annotations.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + +public class CommandParserTest { + + @Test + public void parse_todoCommand_success() { + assertEquals(new AddCommand(new Todo("read book")).getNewTask().getTaskName(), ((AddCommand) new CommandParser(new Ui()).parse("todo read book")).getNewTask().getTaskName()); + } +} diff --git a/src/main/java/test/java/duke/parser/DateTimeParserTest.java b/src/main/java/test/java/duke/parser/DateTimeParserTest.java new file mode 100644 index 0000000000..0ca0cbfa2b --- /dev/null +++ b/src/main/java/test/java/duke/parser/DateTimeParserTest.java @@ -0,0 +1,22 @@ +package test.java.duke.parser; + +import duke.parser.DateTimeParser; +import org.junit.jupiter.api.Test; + +import java.text.ParseException; +import java.text.SimpleDateFormat; + +import static org.junit.jupiter.api.Assertions.*; + +class DateTimeParserTest { + + @Test + void parseDate_20200201_success() throws ParseException { + assertEquals(new DateTimeParser().parseDate("2020-02-01").getTime(), new SimpleDateFormat("yyyy-MM-dd").parse("2020-02-01").getTime()); + } + + @Test + void parseTime() throws ParseException { + assertEquals(new DateTimeParser().parseTime("18:00").getTime(), new SimpleDateFormat("HH:mm").parse("18:00").getTime()); + } +} \ No newline at end of file