forked from nusCS2113-AY1920S1/PersonalAssistant-Duke
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
137 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package task; | ||
|
||
import models.data.Project; | ||
import models.member.Member; | ||
import models.task.Task; | ||
import models.task.TaskState; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.text.ParseException; | ||
import java.text.SimpleDateFormat; | ||
import java.util.ArrayList; | ||
import java.util.Date; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class ViewAssignedTasksTest { | ||
Project project = new Project("Infinity_Gauntlet"); | ||
|
||
@Test | ||
public void alwaysTrue() { | ||
assertEquals(2, 2); | ||
} | ||
|
||
@Test | ||
public void testViewAssignedTask() { | ||
String testAssignedTasks = "1. Dillen (Phone: 9999 | Email: dillen@gmail.com)\n" | ||
+ "2. Jerry (Phone: 9999 | Email: jerryn@gmail.com)"; | ||
String testAssignedTasks2 = "1. Dillen (Phone: 9999 | Email: dillen@gmail.com)"; | ||
try { | ||
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); | ||
Date dueDate = formatter.parse("19/10/2019"); | ||
ArrayList<String> taskRequirements = new ArrayList<>(); | ||
taskRequirements.add("requirement1"); | ||
|
||
project.addTask(new Task("task2",5, dueDate,10, TaskState.TODO, taskRequirements)); | ||
project.addTask(new Task("task1",10, dueDate,10, TaskState.TODO, taskRequirements)); | ||
|
||
project.addMember(new Member("Dillen", "9999", "dillen@gmail.com",1)); | ||
project.addMember(new Member("Jerry", "9999", "jerryn@gmail.com",2)); | ||
|
||
project.getTask(1).assignMember(project.getMembers().getMember(1)); | ||
project.getTask(1).assignMember(project.getMembers().getMember(2)); | ||
project.getTask(2).assignMember(project.getMembers().getMember(1)); | ||
|
||
assertEquals(project.getTask(1).getAssignedTasks().getAllMemberDetails().get(0) + "\n" | ||
+ project.getTask(1).getAssignedTasks().getAllMemberDetails().get(1),testAssignedTasks); | ||
assertEquals(project.getTask(2).getAssignedTasks().getAllMemberDetails().get(0),testAssignedTasks2); | ||
} catch (ParseException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |