fixed RemoveTasksForCrop
This commit is contained in:
parent
c79386ec88
commit
77541c282c
|
@ -88,7 +88,8 @@ public class JsonTaskList implements TaskList {
|
||||||
if(taskMap.isEmpty()) {
|
if(taskMap.isEmpty()) {
|
||||||
loadTaskListFromFile();
|
loadTaskListFromFile();
|
||||||
}
|
}
|
||||||
taskMap.values().removeIf(task -> task.getCropId() == cropId);
|
taskMap.entrySet().removeIf(entry -> entry.getValue().getCropId() == cropId);
|
||||||
|
writeTaskListToFile();
|
||||||
notifySubscribers();
|
notifySubscribers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,17 +47,16 @@ public class JsonTaskListTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Disabled("disabled until adding works.")
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Add task.")
|
@DisplayName("Add task.")
|
||||||
void addTask() {
|
void addTask() {
|
||||||
Task task = new Task("Testtask", "This is a test Task.", LocalDate.parse("01.05.2022", formatter), 1);
|
Task task = new Task("Testtask", "This is a test Task.", LocalDate.parse("2022-05-01", formatter), 1);
|
||||||
try {
|
try {
|
||||||
testDatabase.saveTask(task);
|
testDatabase.saveTask(task);
|
||||||
List<Task> taskList;
|
List<Task> taskList;
|
||||||
try {
|
try {
|
||||||
taskList = testDatabase.getTaskList(LocalDate.parse("30.04.2022", formatter),
|
taskList = testDatabase.getTaskList(LocalDate.parse("2022-04-30", formatter),
|
||||||
LocalDate.parse("31.05.2022", formatter));
|
LocalDate.parse("2022-05-31", formatter));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -72,8 +71,7 @@ public class JsonTaskListTest {
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Remove task.")
|
@DisplayName("Remove task.")
|
||||||
void removeTask() {
|
void removeTask() {
|
||||||
Task task = new Task("Dummy", "Dummy", LocalDate.parse("2022-05-31", formatter), 1)
|
Task task = new Task("Dummy", "Dummy", LocalDate.parse("2022-05-31", formatter), 1).withId(2);
|
||||||
.withId(2);
|
|
||||||
try {
|
try {
|
||||||
testDatabase.removeTask(task);
|
testDatabase.removeTask(task);
|
||||||
List<Task> taskList;
|
List<Task> taskList;
|
||||||
|
@ -102,7 +100,7 @@ public class JsonTaskListTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Disabled("Disabled until removing works")
|
|
||||||
@Test
|
@Test
|
||||||
void removeTasksForCrop() {
|
void removeTasksForCrop() {
|
||||||
List<Task> taskList;
|
List<Task> taskList;
|
||||||
|
|
Loading…
Reference in New Issue