Skip to content

Commit

Permalink
Add additional Parser testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelim01 committed Sep 21, 2023
1 parent 3f317d3 commit e33059f
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 41 deletions.
3 changes: 2 additions & 1 deletion src/main/java/duke/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
*/
public class Duke {

public static final String WELCOME_MESSAGE = "Hello! I'm Duke. What would you like to do today?";

/** The file path where the data of the chatbot is stored */
private static final String FILE_PATH = "data/tasks.txt";


private final Storage storage;
private final TaskList tasks;

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/duke/gui/MainWindow.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package duke.gui;

import static duke.Duke.WELCOME_MESSAGE;

import duke.Duke;
import duke.command.CommandResult;
import duke.data.exception.DukeException;
Expand All @@ -25,9 +27,13 @@ public class MainWindow extends AnchorPane {

private Duke duke;

/**
* Initializes the main window with the given welcome message.
*/
@FXML
public void initialize() {
scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
addDukeDialog(WELCOME_MESSAGE);
}

public void setDuke(Duke d) {
Expand Down
Binary file removed src/main/resources/images/DaUser.png
Binary file not shown.
4 changes: 0 additions & 4 deletions src/main/resources/view/UserDialogBox.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
<font>
<Font name="Source Code Pro" size="12.0" />
</font></Label>
<ImageView fx:id="displayPicture" fitHeight="60.0" fitWidth="60.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/DaUser.png" />
</image></ImageView>
</children>
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/duke/data/task/TaskListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@
import org.junit.jupiter.api.Test;

import duke.data.exception.DukeException;
import duke.data.exception.InvalidTaskIndexException;

public class TaskListTest {

@Test
public void removeTask_invalidIndex_throwsDukeException() {
public void remove_invalidIndex_throwsInvalidTaskIndexException() {
TaskList taskList = new TaskList(
new Todo("todo"),
new Deadline("deadline", LocalDate.now()),
new Event("event", LocalDate.now(), LocalDate.now())
);
assertThrows(DukeException.class, () -> taskList.remove(-1));
assertThrows(DukeException.class, () -> taskList.remove(4));
assertThrows(InvalidTaskIndexException.class, () -> taskList.remove(-1));
assertThrows(InvalidTaskIndexException.class, () -> taskList.remove(4));
}

@Test
public void removeTask_validIndexIndex_taskNotInList() {
public void remove_validIndexIndex_taskNotInList() {
Task toRemove = new Todo("toRemove");
TaskList taskList = new TaskList(
new Todo("todo"),
Expand Down
Loading

0 comments on commit e33059f

Please sign in to comment.