/
Expekt.kt
65 lines (49 loc) · 1.64 KB
/
Expekt.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
package com.winterbe.expekt
fun <T> expect(subject: T?): ExpectAny<T?> {
return ExpectAny(subject, Flavor.EXPECT)
}
fun expect(subject: Boolean?): ExpectBoolean {
return ExpectBoolean(subject, Flavor.EXPECT)
}
fun <T: Comparable<T>> expect(subject: T?): ExpectComparable<T> {
return ExpectComparable(subject, Flavor.EXPECT)
}
fun expect(subject: Double?): ExpectDouble {
return ExpectDouble(subject, Flavor.EXPECT)
}
fun expect(subject: String?): ExpectString {
return ExpectString(subject, Flavor.EXPECT)
}
fun <T> expect(subject: Collection<T>?): ExpectCollection<T> {
return ExpectCollection(subject, Flavor.EXPECT)
}
fun <T> expect(subject: Sequence<T>?): ExpectCollection<T> {
return ExpectCollection(subject?.toList(), Flavor.EXPECT)
}
fun <K, V> expect(subject: Map<K, V>?): ExpectMap<K, V> {
return ExpectMap(subject, Flavor.EXPECT)
}
val <T> T?.should: ExpectAny<T> get() {
return ExpectAny(this, Flavor.SHOULD)
}
val Boolean?.should: ExpectBoolean get() {
return ExpectBoolean(this, Flavor.SHOULD)
}
val String?.should: ExpectString get() {
return ExpectString(this, Flavor.SHOULD)
}
val <T: Comparable<T>> T?.should: ExpectComparable<T> get() {
return ExpectComparable(this, Flavor.SHOULD)
}
val Double?.should: ExpectDouble get() {
return ExpectDouble(this, Flavor.SHOULD)
}
val <T> Collection<T>?.should: ExpectCollection<T> get() {
return ExpectCollection(this, Flavor.SHOULD)
}
val <T> Sequence<T>?.should: ExpectCollection<T> get() {
return ExpectCollection(this?.toList(), Flavor.SHOULD)
}
val <K, V> Map<K, V>?.should: ExpectMap<K, V> get() {
return ExpectMap(this, Flavor.SHOULD)
}