Dan North wrote:
I'm ok with an abstract Given, Event and Outcome for each mocking
framework (I mean, how many do we want to support?).
Each mocking framework has its own dialect and quirks, so I don't see a
useful abstraction that would give us much. We would still need several
interfaces, an adapter for each mocking framework into the mocking
parts, the syntax sugar parts and the constraint/matcher/etc parts, and
probably some other stuff.
Worse yet, if we abstract to the lowest common denominator, those
(majority) of us who are still in java 1.4 land will end up with ugly
casts all over the place, reducing readability even further.
In particular, until we have static imports, the syntax sugar has to
live in superclasses. I toyed with the idea of Return.value(sheep)
rather than returnValue(sheep) a while back, but things like constraints
just get ugly if you try to either use statics or compose them, and you
still end up in casting hell:
Ensure.that(sheep,
(Constraint)c.isA(Sheep.class).and((Constraint)c.not((Constraint)c.isWorried));
// eww
ensureThat(sheep, isA(Sheep.class).and(not(isWorried)); // better
Yes - I agree: abstraction would have as drawback less readability in 1.4
So the issue at hand is not so much to the mocking framework *injectable*, as to support for
different frameworks via different abstract impls of the various scenario components.
So, should we perhaps move the Given/Event/OutcomeUsingMiniMock to
core.minimock package?
And add equivalent Given/Event/OutcomeUsingJMock to jmock extension?
Cheers
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email