Skip to content

Commit 6d4b5bb

Browse files
authored
Upgrade Kotlin version and use more idiomatic Kotlin (#1590)
* Upgrade Kotlin version and use more idiomatic Kotlin * Add new line at end of file (review comment) * Update changelog
1 parent 2a78ce7 commit 6d4b5bb

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
1515
* Allow parameter-types in escaped optional groups ([#cucumber/572](https://github.com/cucumber/cucumber/pull/572), [#cucumber/561](https://github.com/cucumber/cucumber/pull/561) Luke Hill, Jayson Smith, M.P. Korstanje)
1616
* Prefer expression with the longest non-empty match ([#cucumber/580](https://github.com/cucumber/cucumber/pull/580) M.P. Korstanje)
1717
* Improve heuristics for creating Cucumber/Regular Expressions from strings ([#cucumber/518](https://github.com/cucumber/cucumber/pull/518) Aslak Hellesøy)
18+
* [Kotlin-Java8] Upgrade Kotlin to v1.3.0 and more idiomatic Kotlin ([#1590](https://github.com/cucumber/cucumber-jvm/pull/1590) Marit van Dijk)
1819

1920
### Deprecated
2021

kotlin-java8/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<name>Cucumber-JVM: Kotlin Java8</name>
1313

1414
<properties>
15-
<kotlin.version>1.2.41</kotlin.version>
15+
<kotlin.version>1.3.0</kotlin.version>
1616
</properties>
1717

1818
<dependencies>

kotlin-java8/src/test/kotlin/cucumber/runtime/kotlin/test/LambdaStepdefs.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class LambdaStepdefs : En {
5050

5151
Given("A statement with a body expression$") { assertTrue(true) }
5252

53-
Given("A statement with a simple match$", { -> assertTrue(true) })
53+
Given("A statement with a simple match$", { assertTrue(true) })
5454

5555
val localInt = 1
5656
Given("A statement with a scoped argument$", { assertEquals(2, localInt + 1) })
@@ -62,9 +62,6 @@ class LambdaStepdefs : En {
6262
assertEquals(4, d)
6363
}
6464
}
65-
66-
class Person {
67-
var first: String? = null
68-
var last: String? = null
69-
}
7065
}
66+
67+
data class Person(val first: String?, val last: String?)

kotlin-java8/src/test/kotlin/cucumber/runtime/kotlin/test/RunCukesTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ import cucumber.api.junit.Cucumber
44
import org.junit.runner.RunWith
55

66
@RunWith(Cucumber::class)
7-
class RunCukesTest {
8-
}
7+
class RunCukesTest

kotlin-java8/src/test/kotlin/cucumber/runtime/kotlin/test/TypeRegistryConfiguration.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ class TypeRegistryConfiguration : TypeRegistryConfigurer {
1515

1616
override fun configureTypeRegistry(typeRegistry: TypeRegistry) {
1717
typeRegistry.defineDataTableType(DataTableType(
18-
LambdaStepdefs.Person::class.java,
19-
TableEntryTransformer<LambdaStepdefs.Person>
18+
Person::class.java,
19+
TableEntryTransformer<Person>
2020
{ map: Map<String, String> ->
21-
val person = LambdaStepdefs.Person()
22-
person.first = map.get("first")
23-
person.last = map.get("last")
24-
person
21+
Person(map["first"], map["last"])
2522
}))
2623
}
2724
}

0 commit comments

Comments
 (0)