Skip to content

Commit ca07d47

Browse files
committed
Merge branch 'release/2.0.2.1'
2 parents dfac691 + 0566a33 commit ca07d47

File tree

7 files changed

+40
-7
lines changed

7 files changed

+40
-7
lines changed

.java-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17.0
1+
17

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.toolisticon.testing</groupId>
77
<artifactId>jgiven-kotlin-parent</artifactId>
8-
<version>2.0.2.0</version>
8+
<version>2.0.2.1</version>
99
</parent>
1010

1111
<artifactId>jgiven-kotlin</artifactId>

core/src/main/kotlin/io/toolisticon/testing/jgiven/JGivenKotlin.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@file:Suppress("unused")
2+
23
package io.toolisticon.testing.jgiven
34

45
import com.tngtech.jgiven.Stage
@@ -9,16 +10,31 @@ import com.tngtech.jgiven.base.ScenarioTestBase
910
*/
1011
val <G : Stage<G>, W : Stage<W>, T : Stage<T>> ScenarioTestBase<G, W, T>.GIVEN: G get() = given()
1112

13+
/**
14+
* Use `GIVEN` instead of `given()` on Given-Stage "G", allowing you to write `GIVEN { ... }`
15+
*/
16+
fun <G : Stage<G>, W : Stage<W>, T : Stage<T>> ScenarioTestBase<G, W, T>.GIVEN(block: G.() -> G): G = GIVEN.block()
17+
1218
/**
1319
* Use `WHEN` instead of `when()` on When-Stage "W"
1420
*/
1521
val <G : Stage<G>, W : Stage<W>, T : Stage<T>> ScenarioTestBase<G, W, T>.WHEN: W get() = `when`()
1622

23+
/**
24+
* Use `WHEN` instead of `when()` on When-Stage "W", allowing you to write `WHEN { ... }`
25+
*/
26+
fun <G : Stage<G>, W : Stage<W>, T : Stage<T>> ScenarioTestBase<G, W, T>.WHEN(block: W.() -> W): W = WHEN.block()
27+
1728
/**
1829
* Use `THEN` instead of `then()` on Then-Stage "T"
1930
*/
2031
val <G : Stage<G>, W : Stage<W>, T : Stage<T>> ScenarioTestBase<G, W, T>.THEN: T get() = then()
2132

33+
/**
34+
* Use `THEN` instead of `then()` on Then-Stage "T", allowing you to write `THEN { ... }`
35+
*/
36+
fun <G : Stage<G>, W : Stage<W>, T : Stage<T>> ScenarioTestBase<G, W, T>.THEN(block: T.() -> T): T = THEN.block()
37+
2238
/**
2339
* Use `AND` instead of `and()`
2440
*/
@@ -51,4 +67,4 @@ val <X : Stage<X>> Stage<X>.self: X get() = self()!!
5167
* `step` is short for `self().apply {}` and returns the Stage instance for fluent usage.
5268
*
5369
*/
54-
inline fun <X : Stage<X>> Stage<X>.step(block: X.() -> Unit) = self.apply(block)
70+
inline fun <X : Stage<X>> Stage<X>.step(block: X.() -> Unit) = self.apply(block)

core/src/test/kotlin/io/toolisticon/testing/jgiven/CalculatorExampleTest.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@ internal class CalculatorExampleTest : SimpleScenarioTest<CalculatorStage>() {
2727
.`the sum is $`(11)
2828
}
2929

30+
@Test
31+
fun `calculator adds two numbers - receiver style`() {
32+
GIVEN {
33+
`the first number is $`(4)
34+
AND
35+
`the second number is $`(7)
36+
}
37+
38+
WHEN {
39+
`both numbers are added`()
40+
}
41+
42+
THEN {
43+
`the sum is $`(11)
44+
}
45+
}
46+
3047
@Test
3148
fun `calculator adds two numbers as varargs`() {
3249
GIVEN

junit5/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.toolisticon.testing</groupId>
77
<artifactId>jgiven-kotlin-parent</artifactId>
8-
<version>2.0.2.0</version>
8+
<version>2.0.2.1</version>
99
</parent>
1010

1111
<name>JGiven Kotlin - JUnit5</name>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
<parent>
66
<groupId>io.toolisticon.maven.parent</groupId>
77
<artifactId>maven-parent-kotlin-base</artifactId>
8-
<version>2025.3.1</version>
8+
<version>2025.5.0</version>
99
<relativePath/>
1010
</parent>
1111

1212
<groupId>io.toolisticon.testing</groupId>
1313
<artifactId>jgiven-kotlin-parent</artifactId>
14-
<version>2.0.2.0</version>
14+
<version>2.0.2.1</version>
1515

1616
<name>JGiven Kotlin - Parent</name>
1717
<description>jgiven kotlin extension - parent</description>

spring-junit5/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.toolisticon.testing</groupId>
77
<artifactId>jgiven-kotlin-parent</artifactId>
8-
<version>2.0.2.0</version>
8+
<version>2.0.2.1</version>
99
</parent>
1010

1111
<name>JGiven Kotlin - Spring-JUnit5</name>

0 commit comments

Comments
 (0)