Skip to content

Commit

Permalink
Implement A-JUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
yuming7144 committed Aug 25, 2020
1 parent 7be74a9 commit 15b818a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/java/duke/ParserTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package duke;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class ParserTest {
@Test
void parseCommand_Parser_Test() {
try {
Parser.parseCommand("deadline");
} catch (DukeException e) {
assertEquals("The description of a deadline cannot be empty.", e.getMessage());
}
}

@Test
void stopProgram_Parser_Test() {
assertTrue(Parser.stopProgram("bye"));
}
}
18 changes: 18 additions & 0 deletions src/test/java/duke/task/TodoTest.java
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.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class TodoTest {
@Test
void taskToArray_ToDo_Test() {
Todo todo = new Todo("Return book");
String[] expected_arr = new String[]{"T", "1", "Return book"};
assertArrayEquals(expected_arr, todo.taskToArray());
}



}

0 comments on commit 15b818a

Please sign in to comment.