Skip to content

Commit cc0ccf6

Browse files
committed
cover more hooks in tests
1 parent 213c3b6 commit cc0ccf6

File tree

10 files changed

+48
-3
lines changed

10 files changed

+48
-3
lines changed

src/main/kotlin/com/memoizr/assertk/AbstractAssertBuilder.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package com.memoizr.assertk
33
import org.assertj.core.api.AbstractAssert
44
import org.assertj.core.api.Assertions
55

6-
inline fun <reified R : Any> of() = AbstractAssertBuilder.InstanceMatcher<R>()
7-
86
abstract class AbstractAssertBuilder<S : AbstractAssertBuilder<S, A>, A : Any> internal constructor(actual: A?, selfType: Class<*>) {
97
class InstanceMatcher<R>
108

src/main/kotlin/com/memoizr/assertk/CharSequenceAssert.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class CharSequenceAssert internal constructor(
99
override val assertion: AbstractCharSequenceAssert<*, out CharSequence> = assertThat(subject)) :
1010
AbstractAssertBuilder<CharSequenceAssert, CharSequence>(subject, CharSequenceAssert::class.java) {
1111

12-
1312
infix fun _is(assertionTest: SequenceSelector): CharSequenceAssert {
1413
when (assertionTest) {
1514
empty -> assertion.isEmpty()

src/main/kotlin/com/memoizr/assertk/Selectors.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ object notPositive : NumberSelector()
2525
object negative : NumberSelector()
2626
object notNegative : NumberSelector()
2727

28+
inline fun <reified R : Any> of() = AbstractAssertBuilder.InstanceMatcher<R>()
29+

src/test/kotlin/com/memoizr/assertk/CharSequence assert test.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,10 @@ class `CharSequence assert test` {
199199
it contains "foo"
200200
it isSubstringOf "fooBar"
201201
}
202+
203+
expect that "foo" isSuchThat {
204+
it contains "foo"
205+
it isSubstringOf "fooBar"
206+
}
202207
}
203208
}

src/test/kotlin/com/memoizr/assertk/Double assert test.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ class `Double assert test` {
132132
it _is notNegative
133133
it isBetween (negativeOne..three)
134134
}
135+
assert that one isSuchThat {
136+
it _is positive
137+
it _is notNegative
138+
it isBetween (negativeOne..three)
139+
}
135140
}
136141
}
137142

src/test/kotlin/com/memoizr/assertk/Float assert test.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,11 @@ class `Float assert test` {
119119
it _is notNegative
120120
it isBetween (negativeOne..three)
121121
}
122+
123+
assert that one isSuchThat {
124+
it _is positive
125+
it _is notNegative
126+
it isBetween (negativeOne..three)
127+
}
122128
}
123129
}

src/test/kotlin/com/memoizr/assertk/Integer assert test.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,11 @@ class `Integer assert test` {
134134
it _is notNegative
135135
it isBetween (negativeOne..three)
136136
}
137+
138+
assert that one isSuchThat {
139+
it _is positive
140+
it _is notNegative
141+
it isBetween (negativeOne..three)
142+
}
137143
}
138144
}

src/test/kotlin/com/memoizr/assertk/Iterable assert test.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,15 @@ class `Iterable assert test` {
155155
it doesNotHave duplicates
156156
it doesNotContainAnyElementsOf listOf(5, 6)
157157
}
158+
159+
assert that listOf(1, 2, 3, 4) isSuchThat {
160+
it contains onlyNotNull
161+
it endsWith 4
162+
it endsWith listOf(3, 4)
163+
it startsWith 1
164+
it startsWith listOf(1, 2)
165+
it doesNotHave duplicates
166+
it doesNotContainAnyElementsOf listOf(5, 6)
167+
}
158168
}
159169
}

src/test/kotlin/com/memoizr/assertk/LongAssertTest.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ class `Long assert test` {
132132
it _is notNegative
133133
it isBetween (negativeOne..three)
134134
}
135+
136+
assert that one isSuchThat {
137+
it _is positive
138+
it _is notNegative
139+
it isBetween (negativeOne..three)
140+
it isInstance of<Long>()
141+
}
135142
}
136143
}
137144

src/test/kotlin/com/memoizr/assertk/Object assert test.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ class `Object assert test` {
9393
it isNotEqualTo Any()
9494
}
9595

96+
assert that Any() isSuchThat {
97+
it _is notNull
98+
it isInstance of<Any>()
99+
it isNotEqualTo Unit
100+
it isNotEqualTo Any()
101+
}
102+
96103
_expect thatThrownBy {
97104
_expect that Any() isSuchThat {
98105
it _is null

0 commit comments

Comments
 (0)