tomakehurst/wiremock — pull request #103 by rowanhill (2014-03-02 17:39:14+00:00)
Title: Scenario builder generics

This follows on from #84: instead of throwing an exception when building a mapping that specifies a required / next state without specifying a scenario name, this patch makes use of the type checker to ensure that isn't possible.

I'm not really certain this is the best way to go, but after sitting on it for way too long, I figured I may as well just put up a PR and let there be a discussion about it; I won't be offended if we just chuck this away!

Pros:
- The API doesn't allow invalid use of itself
- IDEs will be helpful and only suggest methods that make sense.

Cons:
- It's overly restrictive, and so not 100% backwards compatible: it'll cause any existing code that calls whenScenarioStateIs / willSetStateTo before inScenario to fail to compile now (although it's a simple fix)
- It's fiddly generics code that's possibly more complicated than it's worth