From: Barry K. <bk...@in...> - 2002-11-19 16:54:15
|
Nat Pryce wrote: >Here's some ideas for the API. > > interface Overloaded { > void overloaded( int number ); > void overloaded( String text ); > void notOverloaded( int number ); > } > > Mock mock = new Mock( Overloaded.class ); > > > >Set up expectations on overloaded methods: > > mock.expectVoid( "overloaded", new Class[]{int.class}, > P.args(P.eq(1)) ); > mock.expectVoid( "overloaded", new Class[]{String.class}, > P.args(P.eq("1")) ); > > That will certainly work. But I would rather not allow for the mistake of a mismatch between class and object if possible. That is why I wanted Constraint to be responsible for providing the Class as it already knows (once-and-only-once). -bk |