Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce jgiven-kotlin #407

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jangalinski
Copy link
Contributor

@jangalinski jangalinski commented May 10, 2019

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.

@jangalinski
Copy link
Contributor Author

@janschaefer did you have a chance to have a look into this?

@janschaefer
Copy link
Contributor

janschaefer commented Jun 5, 2019

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.

@jangalinski
Copy link
Contributor Author

Hi, what is the state of this PR? Any chance to consider support for kotlin for 1.0.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants