finished Tests for TaskListModel

This commit is contained in:
schrom01
2022-11-04 14:20:58 +01:00
parent eea530931e
commit 38288f8561
2 changed files with 45 additions and 20 deletions
@@ -9,6 +9,7 @@ import ch.zhaw.gartenverwaltung.types.*;
import java.io.IOException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@@ -105,17 +106,17 @@ public class TaskListModel {
}
/**
* Method to get an Array of 7 Tasklists for the next 7 days. Index 0 is Tasklist for Today.
* @return Array with length 7 (List<Task>[])
* Method to get an List of 7 Tasklists for the next 7 days. Index 0 is Tasklist for Today.
* @return List with length 7 (List<List<Task>>)
* @throws IOException If the database cannot be accessed
*/
public List<Task>[] getTasksUpcomingWeek() throws IOException {
List<Task>[] listArray = new List[7];
public List<List<Task>> getTasksUpcomingWeek() throws IOException {
List<List<Task>> dayTaskList = new ArrayList<>();
for(int i = 0; i < 7; i++) {
LocalDate date = LocalDate.now().plusDays(i);
listArray[i] = taskDatabase.getTaskList(date, date);
dayTaskList.add(taskDatabase.getTaskList(date, date));
}
return listArray;
return dayTaskList;
}
/**