From 82eab6d5cd6ff451bc5eb367544d966d04538729 Mon Sep 17 00:00:00 2001 From: Elias Csomor Date: Mon, 31 Oct 2022 11:21:45 +0100 Subject: [PATCH] continue GardenPlan tests --- .../io/JsonGardenPlanTest.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/test/java/ch/zhaw/gartenverwaltung/io/JsonGardenPlanTest.java b/src/test/java/ch/zhaw/gartenverwaltung/io/JsonGardenPlanTest.java index 159cccf..d6e165b 100644 --- a/src/test/java/ch/zhaw/gartenverwaltung/io/JsonGardenPlanTest.java +++ b/src/test/java/ch/zhaw/gartenverwaltung/io/JsonGardenPlanTest.java @@ -75,8 +75,6 @@ public class JsonGardenPlanTest { @Test @DisplayName("Add new Crop.") void addNewCrop() { - - Crop crop = new Crop(2l, LocalDate.parse("22.02.2023", formatter)); try { testDatabase.saveCrop(crop); @@ -89,13 +87,23 @@ public class JsonGardenPlanTest { } assertTrue(testCrop.isPresent()); Assertions.assertEquals(2l, testCrop.get().getPlantId()); - } catch (IOException e) { throw new RuntimeException(e); } + } - - + @Test + @DisplayName("Remove crop") + void removeCrop(){ + try { + Optional crop = testDatabase.getCropById(2l); + Assertions.assertTrue(crop.isPresent()); + testDatabase.removeCrop(crop.get()); + crop = testDatabase.getCropById(2l); + Assertions.assertFalse(crop.isPresent()); + } catch (IOException e) { + throw new RuntimeException(e); + } } }