File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
src/test/kotlin/entity/zone Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
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 entity.zone
10
+
11
+ import io.kotest.assertions.throwables.shouldThrow
12
+ import io.kotest.core.spec.style.StringSpec
13
+ import io.kotest.matchers.shouldBe
14
+ import io.kotest.matchers.shouldNotBe
15
+
16
+ class RoomTest : StringSpec ({
17
+ val room = Room (RoomID ("r1"), RoomType .OPERATING_ROOM , ZoneID ("z1"))
18
+ val roomUpdated = Room (RoomID ("r1"), RoomType .OPERATING_ROOM , ZoneID ("z1"), name = "name updated")
19
+ val differentRoom = Room (RoomID ("r2"), RoomType .PRE_OPERATING_ROOM , ZoneID ("z1"))
20
+
21
+ " room id should not be empty" {
22
+ shouldThrow<IllegalArgumentException > { RoomID ("") }
23
+ }
24
+
25
+ listOf(
26
+ differentRoom,
27
+ null,
28
+ 4
29
+ ).forEach {
30
+ " a room should not be equal to other rooms with different id, other classes or null" {
31
+ room shouldNotBe it
32
+ }
33
+ }
34
+
35
+ " two rooms are equal only based on their id" {
36
+ room shouldBe roomUpdated
37
+ }
38
+
39
+ " two equal rooms should have the same hashcode" {
40
+ room.hashCode() shouldBe roomUpdated.hashCode()
41
+ }
42
+
43
+ " two different rooms should not have the same hashcode" {
44
+ room.hashCode() shouldNotBe differentRoom.hashCode()
45
+ }
46
+ })
You can’t perform that action at this time.
0 commit comments