That's what I meant - sorry, didn't explain it very well.

In Ensure we will have pairs of methods, called that(...) and ensureThat(...) for each signature. That way, 1.4 folks can do Ensure.that(...), and 1.5 people can statically import Ensure and use ensureThat(...).

Shane Duan wrote:
If someone using Java5 with static import, it will be something like

      result.doesSomething();
      that(result.status(), eq(status));

Are you sure that you don't want the following?  I thought that the
old code read better.
       result.doesSomething();
       ensureThat(result.status(), eq(status))

It seems to that you might as well make UsingMatcher static and people
can just do static import on that class.

Unless you putting adding the Given/When/Then comments into consideration?
      // When
      result.doesSomething();
      // Then
      that(result.status(), eq(status));

Just a thought.

Cheers
Shane

On 12/5/06, Dan North <[EMAIL PROTECTED]> wrote:
Hi Shane.

Annoyingly, we can't use Hamcrest because it's generics-based, and not
designed to be backward-compatible with java 1.4 (our target).

However, I'm creating an abstraction that will make sense to people who
understand Hamcrest, hence the vocabulary switch.

As a post-1.0 activity, I'd like to review jbehave to see how to make it
java 1.5-friendly whilst still being compatible with 1.4. One quick win
would be to have corresponding ensureThat(...) methods in Ensure
alongside all the that(...) methods. That way you can statically import
Ensure and have it read nicely.

Similarly, we can make minimock generics-aware if you're in 1.5, but
castable if not.

Again this came out of one of those annoying conversations with Joe
Walnes where he asks a question like "why aren't you doing this simple
thing?", which completely changes your outlook :)

Cheers,
Dan

Shane Duan wrote:
> hamcrest change, eh? :)
>
> I had some fun/pain with it over the weekend.
>
> http://agileworks.blogspot.com/2006/12/so-much-for-java-generics.html
>
>
> On 5 Dec 2006 08:42:14 -0000, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
>>
>>
>>  Revision 612 Author tastapod Date 2006-12-05 02:42:05 -0600 (Tue, 05
>> Dec
>> 2006)
>> Log Message [dn] replaced constraint with matcher throughout (except in
>> JMockSugar because I can't)
>>


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email






---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to