Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Groovy should throw exception if more then one World registred #458

Closed
Luxor opened this Issue · 4 comments

2 participants

@Luxor
World { new World1() }
World { new World2() }

Second call overrides the first as GroovyBackend is able to support only one world,
we should notify user in this case.

public class GroovyBackend implements Backend {
    private Closure worldClosure;
    private Object groovyWorld;

    private Object getGroovyWorld() {
        if (groovyWorld == null) {
            groovyWorld = worldClosure == null ? new Object() : worldClosure.call();
        }
        return groovyWorld;
    }
@aslakhellesoy

Would you like to submit a pull request for this?

@Luxor

Sure. Will do

@Luxor

Aslak, I think there is no need in this change.
Cucumber should throw Cucumber exception if more then one World defined
Do you agree?

@aslakhellesoy

I think it makes sense to throw an exception if you try to clobber a previously created World be creating a new one. Feel free to close this ticket and create a pull request for the proposed change.

@Luxor Luxor referenced this issue from a commit in Luxor/cucumber-jvm
@Luxor Luxor Issue #458 41c69d2
@Luxor Luxor referenced this issue from a commit in Luxor/cucumber-jvm
@Luxor Luxor Issue #458 0356a97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.