Skip to content

Commit

Permalink
JUnit Tests implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavzzz committed Sep 15, 2022
1 parent 84d9b6f commit 6c36b7c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {
}

dependencies {
implementation 'junit:junit:4.13.1'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
}
Expand All @@ -37,7 +38,7 @@ test {
}

application {
mainClassName = "seedu.duke.Duke"
mainClassName = "Duke.Duke"
}

shadowJar {
Expand Down
1 change: 0 additions & 1 deletion database/duke.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
T;X;
34 changes: 34 additions & 0 deletions src/test/java/Duke/commands/TaskListTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package Duke.commands;

import Duke.Storage;
import Duke.TaskList;
import Duke.tasks.Task;
import Duke.tasks.Todo;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Arrays;

import static org.junit.jupiter.api.Assertions.*;

public class TaskListTest {


@Test
public void add() {
ArrayList<Task> tasks = new ArrayList<>();
Task tempTask = new Todo("");
TaskList taskList = new TaskList(tasks);
Task addedTask = taskList.addTask(tempTask);
assertNotNull(taskList);
}

@Test
public void isValidTaskNumbertest() {
TaskList taskList = new TaskList(Arrays.asList(null, null));
assertFalse(taskList.isValidTaskNumber(10));
}


}

0 comments on commit 6c36b7c

Please sign in to comment.