continue GardenPlan tests

This commit is contained in:
Elias Csomor 2022-10-31 11:21:45 +01:00
parent 5411ac69ae
commit 82eab6d5cd
1 changed files with 13 additions and 5 deletions

View File

@ -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> 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);
}
}
}