Prepare for tests
This commit is contained in:
parent
694da97cd6
commit
af0e73c007
|
@ -0,0 +1,37 @@
|
||||||
|
package ch.zhaw.gartenverwaltung.io;
|
||||||
|
|
||||||
|
import ch.zhaw.gartenverwaltung.types.Task;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
public class JsonTaskDatabaseTest {
|
||||||
|
|
||||||
|
TaskDatabase testDatabase;
|
||||||
|
SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
|
||||||
|
@BeforeEach
|
||||||
|
void connectToDb() {
|
||||||
|
// testDatabase = new JsonTaskDatabase();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Check if results are retrieved completely")
|
||||||
|
void getTasks(){
|
||||||
|
/*
|
||||||
|
List<Task> taskList=null;
|
||||||
|
try {
|
||||||
|
taskList = testDatabase.getTaskList(formatter.parse("01.05.2022"), formatter.parse("01.08.2022"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Assertions.assertTrue(taskList.size()>0);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id" : "1",
|
||||||
|
"name" : "sow plant",
|
||||||
|
"description": "Plant the seeds/ crops in de bed.",
|
||||||
|
"startDate" : "01.05.2022",
|
||||||
|
"endDate" : "01.05.2022",
|
||||||
|
"interval" : "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : "2",
|
||||||
|
"name" : "water plant",
|
||||||
|
"description": "water the plant, so that the soil is wet around the plant.",
|
||||||
|
"startDate" : "01.05.2022",
|
||||||
|
"endDate" : "01.09.2022",
|
||||||
|
"interval" : "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : "3",
|
||||||
|
"name" : "fertilize plant",
|
||||||
|
"description": "The fertilizer has to be mixed with water. Then fertilize the plant's soil with the mixture",
|
||||||
|
"startDate" : "01.06.2022",
|
||||||
|
"endDate" : "01.08.2022",
|
||||||
|
"interval" : "28"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : "4",
|
||||||
|
"name" : "covering plant",
|
||||||
|
"description": "Take a big enough coverage for the plants. Cover the whole plant with a bit space between the plant and the coverage",
|
||||||
|
"startDate" : "15.07.2022",
|
||||||
|
"endDate" : "15.07.2022",
|
||||||
|
"interval" : "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : "5",
|
||||||
|
"name" : "look after plant",
|
||||||
|
"description": "Look for pest or illness at the leaves of the plant. Check the soil around the plant, if the roots are enough covered with soil",
|
||||||
|
"startDate" : "01.05.2022",
|
||||||
|
"endDate" : "01.09.2022",
|
||||||
|
"interval" : "5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : "6",
|
||||||
|
"name" : "harvest plant",
|
||||||
|
"description": "Pull the ripe vegetables out from the soil. Clean them with clear, fresh water. ",
|
||||||
|
"startDate" : "01.09.2022",
|
||||||
|
"endDate" : "01.09.2022",
|
||||||
|
"interval" : "null"
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in New Issue