Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup #17

Merged
merged 2 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void testTotalHoursAccumulation() {
}
//----------------------------------------------------------------------------------------------------------------//
@Test
public void testFindAllToDoTasksWithMultipleTasks() {
public void testFindAllToDoTasks_WithMultipleTasks() {
ArrayList<String> expectedTasks = new ArrayList<>();
for (MyTasksClass task : testTaskListController.getListOfTasks()) {
if (task.getTaskStatus().equals("To Do")) {
Expand All @@ -104,7 +104,7 @@ public void testFindAllToDoTasksWithMultipleTasks() {
Assert.assertEquals("The correct Tasks were not found!!!",expectedTasks, result);
}
@Test
public void testFindAllToDoTasksWithNoTasks() {
public void testFindAllToDoTasks_WithNoTasks() {
for (MyTasksClass task : testTaskListController.getListOfTasks()) {
task.setTaskStatus("Doing");
}
Expand All @@ -115,7 +115,7 @@ public void testFindAllToDoTasksWithNoTasks() {
}
//----------------------------------------------------------------------------------------------------------------//
@Test
public void testFindAllDoingTasksWithMultipleTasks() {
public void testFindAllDoingTasks_WithMultipleTasks() {
ArrayList<String> expectedTasks = new ArrayList<>();
for (MyTasksClass task : testTaskListController.getListOfTasks()) {
if (task.getTaskStatus().equals("Doing")) {
Expand All @@ -129,7 +129,7 @@ public void testFindAllDoingTasksWithMultipleTasks() {
Assert.assertEquals("The correct Tasks were not found!!!",expectedTasks, result);
}
@Test
public void testFindAllDoingTasksWithNoTasks() {
public void testFindAllDoingTasks_WithNoTasks() {
for (MyTasksClass task : testTaskListController.getListOfTasks()) {
task.setTaskStatus("Done");
}
Expand All @@ -140,7 +140,7 @@ public void testFindAllDoingTasksWithNoTasks() {
}
//----------------------------------------------------------------------------------------------------------------//
@Test
public void testFindAllDoneTasksWithMultipleTasks() {
public void testFindAllDoneTasks_WithMultipleTasks() {
ArrayList<String> expectedTasks = new ArrayList<>();
for (MyTasksClass task : testTaskListController.getListOfTasks()) {
if (task.getTaskStatus().equals("Done")) {
Expand All @@ -154,7 +154,7 @@ public void testFindAllDoneTasksWithMultipleTasks() {
Assert.assertEquals("The correct Tasks were not found!!!",expectedTasks, result);
}
@Test
public void testFindAllDoneTasksWithNoTasks() {
public void testFindAllDoneTasks_WithNoTasks() {
for (MyTasksClass task : testTaskListController.getListOfTasks()) {
task.setTaskStatus("To Do");
}
Expand All @@ -174,13 +174,13 @@ public void testFindShortestTask() {
Assert.assertEquals("Task Incorrect",expectedResult, result);
}
@Test
public void testFindShortestTaskWithEmptyList() {
public void testFindShortestTask_WithEmptyList() {
testTaskListController.getListOfTasks().clear(); // Clear the list to simulate an empty list
String result = testTaskListController.findShortestTask();
Assert.assertNull(result);
}
@Test
public void testFindShortestTaskWithEqualDurations() {
public void testFindShortestTask_WithEqualDurations() {
MyTasksClass task5 = new MyTasksClass(5, "Task 5", "Description 1",
1, "To Do", "Developer 5");
MyTasksClass task6 = new MyTasksClass(6, "Task 6", "Description 2",
Expand All @@ -205,13 +205,13 @@ public void testFindLowestTask() {
Assert.assertEquals("Task Incorrect",expectedResult, result);
}
@Test
public void testFindLowestTaskWithEmptyList() {
public void testFindLowestTask_WithEmptyList() {
testTaskListController.getListOfTasks().clear(); // Clear the list to simulate an empty list
String result = testTaskListController.findLongestTask();
Assert.assertNull(result);
}
@Test
public void testFindLowestTaskWithEqualDurations() {
public void testFindLowestTask_WithEqualDurations() {
MyTasksClass task5 = new MyTasksClass(5, "Task 5", "Description 1",
20, "To Do", "Developer 5");
MyTasksClass task6 = new MyTasksClass(6, "Task 6", "Description 2",
Expand All @@ -227,7 +227,7 @@ public void testFindLowestTaskWithEqualDurations() {
}
//----------------------------------------------------------------------------------------------------------------//
@Test
public void testSearchForExistingTask() {
public void testSearchFor_ExistingTask() {
// Testing for an existing task
MyTasksClass expectedTask = testTaskListController.getListOfTasks().get(0); // Get the first task from the list
String expectedResult = "-> Task Name : " + expectedTask.getTaskName() + "\n"
Expand All @@ -238,21 +238,21 @@ public void testSearchForExistingTask() {
Assert.assertEquals("The task was not found", expectedResult, result);
}
@Test
public void testSearchForNonExistingTask() {
public void testSearchFor_NonExistingTask() {
// Testing for a non existing task
String nonExistingTaskName = "Non-existing Task";
String result = testTaskListController.searchForTask(nonExistingTaskName);
Assert.assertNull("The task was not meant to be found!!!", result);
}
@Test
public void testSearchForTaskWithNullName() {
public void testSearchFor_TaskWithNullName() {
// Testing a search with a Null name
String result = testTaskListController.searchForTask(null);
Assert.assertNull("That should return Null!!!", result);
}
//----------------------------------------------------------------------------------------------------------------//
@Test
public void testFindAllDevsTasksWithExistingDevName() {
public void testFindAllDevsTasks_WithExistingDevName() {
String devName = testTaskDevs[0]; // Using the first developer name from @Before data

ArrayList<String> expectedTasks = new ArrayList<>();
Expand All @@ -267,22 +267,22 @@ public void testFindAllDevsTasksWithExistingDevName() {
Assert.assertEquals("Tasks were incorrect",expectedTasks, result);
}
@Test
public void testFindAllDevsTasksWithNoAssignedTasks() {
public void testFindAllDevsTasks_WithNoAssignedTasks() {
String devName = "Non-existing Developer";

ArrayList<String > result = testTaskListController.findAllDevsTasks(devName);
Assert.assertNotNull(result);
Assert.assertTrue(result.isEmpty());
}
@Test
public void testFindAllDevsTasksWithNullDevName() {
public void testFindAllDevsTasks_WithNullDevName() {
ArrayList<String> result = testTaskListController.findAllDevsTasks(null);
Assert.assertNotNull(result);
Assert.assertTrue(result.isEmpty());
}
//----------------------------------------------------------------------------------------------------------------//
@Test
public void testDeleteExistingTask() {
public void testDelete_ExistingTask() {
String taskToDeleteName = testTaskName[0]; // Get the name of the first task
MyTasksClass taskToDelete = testTaskListController.getListOfTasks().get(0);
String expectedResult = "Entry " + taskToDeleteName + " successfully deleted";
Expand All @@ -292,7 +292,7 @@ public void testDeleteExistingTask() {
Assert.assertFalse(testTaskListController.getListOfTasks().contains(taskToDelete));
}
@Test
public void testDeleteNonExistingTask() {
public void testDelete_NonExistingTask() {
String nonExistingTaskName = "Non-existing Task";
String expectedResult = "No entry with that name was found";

Expand Down
Binary file not shown.
Binary file not shown.