Unit tests
- Do a unit test that attempts parsing BROKEN shcedule JSON data
This commit is contained in:
parent
04dc338183
commit
97508fe66c
|
@ -165,4 +165,30 @@ unittest
|
|||
{
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test building a `Schedule` from the example JSON
|
||||
* buit where the JSON is BROKEN
|
||||
*/
|
||||
private unittest
|
||||
{
|
||||
string json = `
|
||||
{
|
||||
"area_name": "western-cape-worscester",
|
||||
"stage": 4,
|
||||
"start": "2023-06-01T14:00:00+02:00",
|
||||
"finsh": 2
|
||||
}`;
|
||||
|
||||
try
|
||||
{
|
||||
Schedule schedule = Schedule.fromJSON(parseJSON(json));
|
||||
|
||||
assert(false);
|
||||
}
|
||||
catch(EskomCalendarException e)
|
||||
{
|
||||
assert(e.getError() == ErrType.INVALID_SCHEDULE_DATA);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue