|
8 | 8 |
|
9 | 9 | package application.presenter.api
|
10 | 10 |
|
| 11 | +import application.presenter.api.deserializer.ApiDeserializer.toMedicalTechnology |
11 | 12 | import application.presenter.api.deserializer.ApiDeserializer.toRoom
|
12 | 13 | import application.presenter.api.model.EnvironmentalDataApiDto
|
| 14 | +import application.presenter.api.model.MedicalTechnologyApiDto |
| 15 | +import application.presenter.api.model.MedicalTechnologyApiDtoType |
13 | 16 | import application.presenter.api.model.RoomApiDto
|
14 | 17 | import application.presenter.api.model.RoomApiDtoType
|
| 18 | +import application.presenter.api.model.RoomEntry |
15 | 19 | import application.presenter.api.model.ValueWithUnit
|
| 20 | +import application.presenter.api.serializer.ApiSerializer.toMedicalTechnologyApiDto |
16 | 21 | import application.presenter.api.serializer.ApiSerializer.toRoomApiDto
|
| 22 | +import application.presenter.api.serializer.ApiSerializer.toRoomEntry |
17 | 23 | import entity.environment.Humidity
|
18 | 24 | import entity.environment.LightUnit
|
19 | 25 | import entity.environment.Luminosity
|
20 | 26 | import entity.environment.Presence
|
21 | 27 | import entity.environment.Temperature
|
22 | 28 | import entity.environment.TemperatureUnit
|
| 29 | +import entity.medicaltechnology.MedicalTechnology |
| 30 | +import entity.medicaltechnology.MedicalTechnologyID |
| 31 | +import entity.medicaltechnology.MedicalTechnologyType |
23 | 32 | import entity.zone.Room
|
24 | 33 | import entity.zone.RoomEnvironmentalData
|
25 | 34 | import entity.zone.RoomID
|
@@ -54,11 +63,46 @@ class ApiSerializationTest : StringSpec({
|
54 | 63 | )
|
55 | 64 | )
|
56 | 65 |
|
| 66 | + val medicalTechnology = MedicalTechnology( |
| 67 | + id = MedicalTechnologyID("mt-1"), |
| 68 | + name = "name", |
| 69 | + description = "description", |
| 70 | + type = MedicalTechnologyType.ENDOSCOPE, |
| 71 | + isInUse = true, |
| 72 | + roomId = RoomID("r-1") |
| 73 | + ) |
| 74 | + |
| 75 | + val medicalTechnologyApiDto = MedicalTechnologyApiDto( |
| 76 | + id = "mt-1", |
| 77 | + name = "name", |
| 78 | + description = "description", |
| 79 | + type = MedicalTechnologyApiDtoType.ENDOSCOPE, |
| 80 | + inUse = true, |
| 81 | + roomId = "r-1" |
| 82 | + ) |
| 83 | + |
57 | 84 | "It should be possible to obtain the corresponding room from the data get from the API" {
|
58 | 85 | roomApiDto.toRoom() shouldBe room
|
59 | 86 | }
|
60 | 87 |
|
61 |
| - "It should be possibile to serialize a room in order to send it through the API" { |
| 88 | + "It should be possible to serialize a room in order to send it through the API" { |
62 | 89 | room.toRoomApiDto() shouldBe roomApiDto
|
63 | 90 | }
|
| 91 | + |
| 92 | + "It should be possible to serialize a room in a room entry" { |
| 93 | + room.toRoomEntry() shouldBe RoomEntry( |
| 94 | + id = room.id.value, |
| 95 | + name = room.name ?: "", |
| 96 | + zoneId = room.zoneId.value, |
| 97 | + type = room.type.toString() |
| 98 | + ) |
| 99 | + } |
| 100 | + |
| 101 | + "It should be possible to obtain the corresponding medical technology from the data get from the API" { |
| 102 | + medicalTechnologyApiDto.toMedicalTechnology() shouldBe medicalTechnology |
| 103 | + } |
| 104 | + |
| 105 | + "It should be possible to serialize a medical technology in order to send it through the API" { |
| 106 | + medicalTechnology.toMedicalTechnologyApiDto() shouldBe medicalTechnologyApiDto |
| 107 | + } |
64 | 108 | })
|
0 commit comments