forked from nus-cs2103-AY2021S1/ip
-
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
hansebastian
committed
Aug 24, 2020
1 parent
724956d
commit bf5ab46
Showing
32 changed files
with
272 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,50 @@ | ||
package duke; | ||
|
||
import duke.command.ByeCommand; | ||
import duke.command.Command; | ||
import duke.command.ListCommand; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class ParserTest { | ||
@Test | ||
public void parseCommand_unkownCommand_exceptionThrown() { | ||
try { | ||
Command c = Parser.parse("asd"); | ||
} catch (DukeException e) { | ||
assertTrue(e.getMessage().contains("I'm sorry, but I don't know what that means :-(")); | ||
} | ||
} | ||
|
||
@Test | ||
public void parseCommand_byeCommand_byeCommandObjectCreated() { | ||
try { | ||
Command c = Parser.parse("bye"); | ||
assertTrue(c instanceof ByeCommand); | ||
|
||
} catch (DukeException e) { | ||
System.out.println("Test failed"); | ||
} | ||
} | ||
|
||
@Test | ||
public void parseCommand_listCommand_listCommandObjectCreated() { | ||
try { | ||
Command c = Parser.parse("list"); | ||
assertTrue(c instanceof ListCommand); | ||
|
||
} catch (DukeException e) { | ||
System.out.println("Test failed"); | ||
} | ||
} | ||
|
||
@Test | ||
public void parseCommand_unspecifiedDoneCommand_exceptionThrown() { | ||
try { | ||
Command c = Parser.parse("done"); | ||
} catch (DukeException e) { | ||
assertTrue(e.getMessage().contains("Please enter a valid task number for me to mark as done.")); | ||
} | ||
} | ||
} |
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,13 @@ | ||
package duke.command; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class ByeCommandTest { | ||
@Test | ||
public void isExitTrue_byeCommandCreated_true() { | ||
Command test = new ByeCommand(); | ||
assertTrue(test.isExit()); | ||
} | ||
|
||
} |
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,38 @@ | ||
package duke.task; | ||
|
||
import duke.DukeException; | ||
import duke.Parser; | ||
import duke.command.Command; | ||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class DeadlineTest { | ||
@Test | ||
public void createDeadline_withoutDateTime_exceptionThrown() { | ||
try { | ||
Deadline d = new Deadline("submission", ""); | ||
} catch (DukeException e) { | ||
assertTrue(e.getMessage().contains("Please input date and time in correct format")); | ||
} | ||
} | ||
|
||
@Test | ||
public void createDeadline_withoutInvalidDateTime_exceptionThrown() { | ||
try { | ||
Deadline d = new Deadline("submission", "2020/14/54 2810"); | ||
} catch (DukeException e) { | ||
assertTrue(e.getMessage().contains("Please input date and time in correct format")); | ||
} | ||
} | ||
|
||
@Test | ||
public void createDeadline_withDateTime_deadlineCreated() { | ||
try { | ||
Deadline d = new Deadline("submission", "2020/11/14 15:30"); | ||
assertTrue(d instanceof Deadline); | ||
} catch (DukeException e) { | ||
System.out.println("Test failed"); | ||
} | ||
} | ||
} |
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,18 @@ | ||
package duke.task; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class ToDoTest { | ||
@Test | ||
public void createTodo_withDescription_stringReturned() { | ||
ToDo test = new ToDo("Walk Dog"); | ||
assertEquals("T | 0 | Walk Dog",test.toString()); | ||
} | ||
|
||
@Test | ||
public void createTodo_withOutDescription_stringReturned() { | ||
ToDo test = new ToDo(""); | ||
assertEquals("T | 0 | ",test.toString()); | ||
} | ||
} |
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.
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.
Binary file not shown.