-
Notifications
You must be signed in to change notification settings - Fork 197
/
AdditionalMatchersTest.kt
108 lines (95 loc) · 2.39 KB
/
AdditionalMatchersTest.kt
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package test
import org.junit.Test
import org.mockito.kotlin.*
class AdditionalCaptorsTest : TestBase() {
@Test
fun testGeq() {
mock<Methods>().apply {
int(1)
verify(this).int(geq(0))
verify(this).int(geq(1))
verify(this, never()).int(geq(2))
}
}
@Test
fun testLeq() {
mock<Methods>().apply {
int(1)
verify(this).int(leq(2))
verify(this).int(leq(1))
verify(this, never()).int(leq(0))
}
}
@Test
fun testGt() {
mock<Methods>().apply {
int(1)
verify(this).int(gt(0))
verify(this, never()).int(gt(1))
}
}
@Test
fun testLt() {
mock<Methods>().apply {
int(1)
verify(this).int(lt(2))
verify(this, never()).int(lt(1))
}
}
@Test
fun testCmpEq() {
mock<Methods>().apply {
int(1)
verify(this).int(cmpEq(1))
verify(this, never()).int(cmpEq(2))
}
}
@Test
fun testAryEqPrimitive() {
mock<Methods>().apply {
intArray(intArrayOf(1, 2, 3))
verify(this).intArray(aryEq(intArrayOf(1, 2, 3)))
verify(this, never()).intArray(aryEq(intArrayOf(1, 2)))
}
}
@Test
fun testAryEq() {
mock<Methods>().apply {
stringArray(arrayOf("Hello", "there"))
verify(this).stringArray(aryEq(arrayOf("Hello", "there")))
verify(this, never()).stringArray(aryEq(arrayOf("Hello")))
}
}
@Test
fun testfind() {
mock<Methods>().apply {
string("Hello")
verify(this).string(find("l+o$".toRegex()))
verify(this, never()).string(find("l$".toRegex()))
}
}
@Test
fun testAnd() {
mock<Methods>().apply {
int(5)
verify(this).int(and(geq(4), leq(6)))
verify(this, never()).int(and(geq(4), leq(4)))
}
}
@Test
fun testOr() {
mock<Methods>().apply {
int(5)
verify(this).int(and(gt(4), lt(6)))
verify(this, never()).int(and(gt(4), lt(4)))
}
}
@Test
fun testNot() {
mock<Methods>().apply {
int(5)
verify(this).int(not(eq(4)))
verify(this, never()).int(not(eq(5)))
}
}
}