Camel case Java snippet generation #302

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@rapaul
Contributor

rapaul commented Apr 21, 2012

JavaSnippetTest.java is the end result of this change, iHaveCukesInMyBelly instead of I_have_cukes_in_my_belly.

Pushed the creation of a language specific function name down into the
implementations of Snippet. Most languages don't create functions, so
all languages besides Java & Jython return null for this.

Camel case Java snippet generation
Pushed the creation of a language specific function name down into the
implementations of Snippet. Most languages don't create functions, so
all languages besides Java & Jython return null for this.
@aslakhellesoy

This comment has been minimized.

Show comment
Hide comment
@aslakhellesoy

aslakhellesoy Apr 22, 2012

Contributor

I personally find it a lot easier to read I_have_cukes_in_my_belly than iHaveCukesInMyBelly and I have adopted this style for my JUnit tests as well.

To me, readability is more important than following a naming convention. I only apply this to test code, which tends to have long sentence-like method names, not production code or APIs.

Contributor

aslakhellesoy commented Apr 22, 2012

I personally find it a lot easier to read I_have_cukes_in_my_belly than iHaveCukesInMyBelly and I have adopted this style for my JUnit tests as well.

To me, readability is more important than following a naming convention. I only apply this to test code, which tends to have long sentence-like method names, not production code or APIs.

@rapaul rapaul closed this Apr 22, 2012

@meza

This comment has been minimized.

Show comment
Hide comment
@meza

meza Jul 18, 2013

Contributor

Is there a way to make this configurable? It could still default to the underscore style if you wish.

Contributor

meza commented Jul 18, 2013

Is there a way to make this configurable? It could still default to the underscore style if you wish.

@aslakhellesoy

This comment has been minimized.

Show comment
Hide comment
@aslakhellesoy

aslakhellesoy Jul 18, 2013

Contributor

Only if someone sends a pull request. It could be toggled with a command line argument: --snippets [camelcase|underscore] where underscore is the default.

I'm fully aware that underscore is non-idiomatic for java, but I prefer it in sentence-like test methods since I find it easier to read.

Contributor

aslakhellesoy commented Jul 18, 2013

Only if someone sends a pull request. It could be toggled with a command line argument: --snippets [camelcase|underscore] where underscore is the default.

I'm fully aware that underscore is non-idiomatic for java, but I prefer it in sentence-like test methods since I find it easier to read.

@meza

This comment has been minimized.

Show comment
Hide comment
@meza

meza Jul 18, 2013

Contributor

Okay, I'll do it!
On 18 Jul 2013 14:34, "Aslak Hellesøy" notifications@github.com wrote:

Only if someone sends a pull request. It could be toggled with a command
line argument: --snippets [camelcase|underscore] where underscore is the
default.

I'm fully aware that underscore is non-idiomatic for java, but I prefer it
in sentence-like test methods since I find it easier to read.


Reply to this email directly or view it on GitHubhttps://github.com/cucumber/cucumber-jvm/pull/302#issuecomment-21183337
.

Contributor

meza commented Jul 18, 2013

Okay, I'll do it!
On 18 Jul 2013 14:34, "Aslak Hellesøy" notifications@github.com wrote:

Only if someone sends a pull request. It could be toggled with a command
line argument: --snippets [camelcase|underscore] where underscore is the
default.

I'm fully aware that underscore is non-idiomatic for java, but I prefer it
in sentence-like test methods since I find it easier to read.


Reply to this email directly or view it on GitHubhttps://github.com/cucumber/cucumber-jvm/pull/302#issuecomment-21183337
.

@meza

This comment has been minimized.

Show comment
Hide comment
@meza

meza Jul 19, 2013

Contributor

I'm at a point where I need to decide to add the snippet type to the Backend getSnippet interface, or do an ugly if and hack it into the java backend only.
Which one would you prefer?

Contributor

meza commented Jul 19, 2013

I'm at a point where I need to decide to add the snippet type to the Backend getSnippet interface, or do an ugly if and hack it into the java backend only.
Which one would you prefer?

@meza

This comment has been minimized.

Show comment
Hide comment
@meza

meza Jul 19, 2013

Contributor

Forget it, going with a non ugly, only java solution.

Contributor

meza commented Jul 19, 2013

Forget it, going with a non ugly, only java solution.

aslakhellesoy added a commit that referenced this pull request Aug 13, 2013

@aslakhellesoy aslakhellesoy referenced this pull request in cucumber/cucumber-ruby Mar 6, 2014

Closed

Generates unconventional methods #646

@brasmusson brasmusson referenced this pull request May 27, 2017

Merged

Use deterministic unique ids in Descriptions #1134

2 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment