forked from nus-cs2103-AY1920S2/duke
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf0106e
commit bcff413
Showing
15 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
public abstract class Command { | ||
|
||
|
||
/** | ||
* Executes the task based on the eventual type | ||
* | ||
|
14 changes: 14 additions & 0 deletions
14
src/main/java/test/java/duke/entity/task/DeadlineTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)"); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/test/java/duke/parser/CommandParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/test/java/duke/parser/DateTimeParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
} |