JGiven
JGiven copied to clipboard
introduce jgiven-kotlin
Kotlin is working just fine with jgiven, but in day to day usage, some problems occur. This module provides useful fixes and extensions:
- it contains a JGivenStage annotation that can be used to configure the kotlin "all-open" plugin, otherwise stage classes and all stage methods would have to be explicitly marked as open
- "when" is a keyword in kotlin, so Stage.when() has to be written as Stage.'when'() ... I introduced extension properties for given()/when()/then()/... so a kotlin test can be written like:
class JGivenKotlinExtensionTest : ScenarioTest<JGivenKotlinGiven, JGivenKotlinWhen, JGivenKotlinThen>() {
@Test
fun `add two numbers`() {
GIVEN
.number(5)
WHEN
.we_add_number(7)
THEN
.the_result_is(12)
}
}
What do you think?
Attention: this is just a kick-off PR, if you would integrate this into jgiven, we'd have to set up the dokka plugin for java doc generation.
@janschaefer did you have a chance to have a look into this?
As far as I can evaluate it (I am not a Kotlin developer) it looks good. I am not a big fan of all uppercase GIVEN, WHEN, THEN, but I guess lower case is not possible and it is just my taste.
Hi, what is the state of this PR? Any chance to consider support for kotlin for 1.0.0?