-
-
Notifications
You must be signed in to change notification settings - Fork 332
/
Issue386Test.kt
83 lines (71 loc) · 1.79 KB
/
Issue386Test.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
package io.mockk.gh
import io.mockk.MockKAnnotations
import io.mockk.impl.annotations.RelaxedMockK
import org.junit.Before
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class ReturningCollections {
fun getList(): List<Any> {
return listOf()
}
fun getMap(): Map<Any, Any> {
return mapOf()
}
fun getSet(): Set<Any> {
return setOf()
}
fun getArrayList(): ArrayList<Any> {
return arrayListOf()
}
fun getHashMap(): HashMap<Any, Any> {
return hashMapOf()
}
fun getHashSet(): HashSet<Any> {
return hashSetOf()
}
}
class Issue386Test {
@RelaxedMockK
private lateinit var returningCollections : ReturningCollections
@Before
fun setup() {
MockKAnnotations.init(this, relaxUnitFun = true)
}
@Test
fun getList() {
val list = returningCollections.getList()
assertEquals(0, list.size)
assertTrue(list.isEmpty())
}
@Test
fun getMap() {
val map = returningCollections.getMap()
assertEquals(0, map.size)
assertTrue(map.isEmpty())
}
@Test
fun getSet() {
val set = returningCollections.getSet()
assertEquals(0, set.size)
assertTrue(set.isEmpty())
}
@Test
fun getArrayList() {
val arraylist = returningCollections.getArrayList()
assertEquals(0, arraylist.size)
assertTrue(arraylist.isEmpty())
}
@Test
fun getHashMap() {
val hashmap = returningCollections.getHashMap()
assertEquals(0, hashmap.size)
assertTrue(hashmap.isEmpty())
}
@Test
fun getHashSet() {
val hashset = returningCollections.getHashSet()
assertEquals(0, hashset.size)
assertTrue(hashset.isEmpty())
}
}