58 lines
1.5 KiB
Java
58 lines
1.5 KiB
Java
package project;
|
|
import hhn.temp.project.Main;
|
|
import hhn.temp.project.TaskManager;
|
|
import hhn.temp.project.Task;
|
|
import hhn.temp.project.TaskStatus;
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
import org.junit.jupiter.api.DisplayName;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
public class GoodCaseTaskTest {
|
|
|
|
private TaskManager taskManager;
|
|
|
|
@BeforeEach
|
|
public void setup() {
|
|
Main main = new Main();
|
|
taskManager = new TaskManager();
|
|
|
|
}
|
|
|
|
@Test
|
|
@DisplayName("Create a new Task")
|
|
public void assertCreateNewTask() {
|
|
String name = "Name";
|
|
String description = "Description";
|
|
Task task = taskManager.createTask(name, description);
|
|
assertNotNull(task);
|
|
assertEquals(name, task.getName());
|
|
assertEquals(description, task.getDescription());
|
|
assertEquals(TaskStatus.OPEN, task.getStatus());
|
|
|
|
}
|
|
|
|
@Test
|
|
@DisplayName("Edit Task")
|
|
public void assertEditATask() {
|
|
String name = "Name";
|
|
String description = "Description";
|
|
//String newName = "Name2";
|
|
String newDescription = "Description2";
|
|
Task task = taskManager.createTask(name, description);
|
|
assertNotNull(task);
|
|
|
|
assertEquals(description, task.getDescription());
|
|
task.setDescription(newDescription);
|
|
assertEquals(newDescription, task.getDescription());
|
|
|
|
assertEquals(TaskStatus.OPEN, task.getStatus());
|
|
task.setStatus(TaskStatus.IN_PROCESS);
|
|
assertEquals(TaskStatus.IN_PROCESS, task.getStatus());
|
|
|
|
|
|
|
|
}
|
|
}
|