From: Nat P. <nat...@b1...> - 2002-11-19 18:24:07
|
On Tue, 2002-11-19 at 17:23, Barry Kaplan wrote: > Nat Pryce wrote: > > On Tue, 2002-11-19 at 16:59, Barry Kaplan wrote: > > > > > That will certainly work. But I would rather not allow for the mistake > > > of a mismatch between class and object if possible. > > > > > > > That would be checked when setupXXX or expectXXX is called. Any > > mismatch would result in an AssertionFailedError being thrown at that > > point. Mismatch at invocation time would be prevented by Java's type > > system. > But it still requires the programmer to specify the same information > in two places. > > > That is why I wanted > > > Constraint to be responsible for providing the Class as it already knows > > > (once-and-only-once). > > > In my opinion it is only specified once. The constraints check object *values* and can assume that the types are already checked by the language. The only time you would need to specify types explicitly is to disambiguate overloaded methods. Cheers, Nat. -- Nat Pryce <nat...@b1...> B13media |