Skip to content

Commit dac5511

Browse files
committed
Add Junit test for Parser class
1 parent b0ac180 commit dac5511

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/test/java/util/ParserTest.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,28 @@
1-
package util;public class ParserTest {
1+
package util;
2+
3+
import duke.exception.EmptyDescriptionException;
4+
import duke.exception.IncompleteDescriptionException;
5+
import duke.util.Parser;
6+
import org.junit.jupiter.api.Test;
7+
8+
import static org.junit.jupiter.api.Assertions.assertEquals;
9+
import static org.junit.jupiter.api.Assertions.assertThrows;
10+
11+
public class ParserTest {
12+
13+
@Test
14+
public void emptyCommandTest() {
15+
assertThrows(EmptyDescriptionException.class, () -> Parser.parse(""));
16+
}
17+
18+
@Test
19+
public void incompleteCommandTest() {
20+
assertThrows(EmptyDescriptionException.class, () -> Parser.parse("todo "));
21+
}
22+
23+
@Test
24+
public void allSpaceCommandTest() {
25+
assertThrows(EmptyDescriptionException.class, () -> Parser.parse(" "));
26+
}
27+
228
}

0 commit comments

Comments
 (0)