That's a good idea. Can you submit that as a feature request via
Sourceforge? Request 4 is impossible for most constraints (because a
Constraint has no concept of "type") unless we extend the Constraint
interface with methods that to perform early checks. However, I would
rather keep the Constraint interface as simple as possible to make it
trivially easy to write new Constraints. That approach has helped make the
Constraint concept very easy for new users to understand and use, and also
kept the Constraint interface very stable (it hasn't changed since first
introduced).
Cheers,
Nat.
_______________________
Dr. Nathaniel Pryce
B13media Ltd.
http://www.b13media.com
+44 (0)7712 526 661
----- Original Message -----
From: "Barry Kaplan" <bk...@in...>
To: "mockobjects" <moc...@li...>
Sent: Friday, August 22, 2003 2:29 PM
Subject: [MO-java-dev] expect() validations?
> (Steve)
>
> As part of the latest DM overhual, is the issue of performing some
> validation (ie, fail fast) of expectations? For example, given:
>
> public interface Foo {
> public void bar(Blob blob);
> }
> ...
> // 1. no method tweetle on interface
> mockFoo.expect("tweetle", aBlob);
> // 2. no bar method that takes two arguments
> mockFoo.expect("bar", C.args(C.eq(aBlob), C.eq(aTweetle)));
> // 3. no bar method that returns a Tweetle
> mockFoo.expectAndReturn("bar", aBlob, aTweetle);
> // 4. no bar method that takes a Tweetle argument
> mockFoo.expect("bar", C.eq(aTweetle));
>
> ----
>
> 1, 2, 3 /could/ be done with the current design. It just isnt' resulting
> strange test executions that could have failed immediatly at setup time.
>
> 4 would require some method of "knowing" a constraint's type. That is
> the type of its argument. Of course this may not always be possible, but
> when it is could be used to help validate the expectations.
>
> -bk
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: VM Ware
> With VMware you can run multiple operating systems on a single machine.
> WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
> at the same time. Free trial click
here:http://www.vmware.com/wl/offer/358/0
> _______________________________________________
> Mockobjects-java-dev mailing list
> Moc...@li...
> https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev
|