Skip to content

Commit 7693718

Browse files
test: create digital twin manager stub
1 parent 842df5c commit 7693718

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package infrastructure.digitaltwins
10+
11+
import application.controller.manager.RoomDigitalTwinManager
12+
import entity.zone.Room
13+
import entity.zone.RoomID
14+
15+
/**
16+
* Simple Stub for [RoomDigitalTwinManager] in order to perform tests.
17+
*/
18+
class DigitalTwinManagerStub : RoomDigitalTwinManager {
19+
private val roomList: MutableSet<Room> = mutableSetOf()
20+
21+
override fun createRoomDigitalTwin(room: Room): Boolean {
22+
this.roomList.add(room)
23+
return true
24+
}
25+
26+
override fun deleteRoomDigitalTwin(roomId: RoomID): Boolean {
27+
return this.roomList.removeIf { it.id == roomId }
28+
}
29+
30+
override fun findBy(roomId: RoomID): Room? {
31+
return this.roomList.find { it.id == roomId }
32+
}
33+
}

0 commit comments

Comments
 (0)