-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaRecordUtils.test.scala
More file actions
46 lines (39 loc) · 1.01 KB
/
JavaRecordUtils.test.scala
File metadata and controls
46 lines (39 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package org.encalmo.utils
import JavaRecordUtilsTestMacro.*
class JavaRecordUtilsSpec extends munit.FunSuite {
val entity = Order(
"1234567890",
"John Doe",
java.util.List.of(100, 200, 300),
java.math.BigDecimal(1000)
)
test("collect record") {
assertEquals(
testCollectMethod(entity),
List(
"id: String = 1234567890",
"customerId: String = John Doe",
"items: List[Integer] = [100, 200, 300]",
"total: BigDecimal = 1000"
)
)
}
test("collect not a record") {
assertEquals(
testCollectMethod("not a record"),
Nil
)
}
test("visit record") {
assertEquals(
testVisitMethod(entity),
"id: String = 1234567890, customerId: String = John Doe, items: List[Integer] = [100, 200, 300], total: BigDecimal = 1000"
)
}
test("visit record without value term") {
assertEquals(
testVisitTermlessMethod[Order],
"id: String, customerId: String, items: List[Integer], total: BigDecimal"
)
}
}