From: Barry K. <bk...@in...> - 2002-11-19 17:18:43
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title></title> </head> <body> Nat Pryce wrote:<br> <blockquote type="cite" cite="mid...@ba..."> <pre wrap="">On Tue, 2002-11-19 at 16:59, Barry Kaplan wrote: </pre> <blockquote type="cite"> <pre wrap="">That will certainly work. But I would rather not allow for the mistake of a mismatch between class and object if possible. </pre> </blockquote> <pre wrap=""><!----> 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.</pre> </blockquote> But it still requires the programmer to specify the same information in two places.<br> <blockquote type="cite" cite="mid...@ba..."> <blockquote type="cite"> <pre wrap="">That is why I wanted Constraint to be responsible for providing the Class as it already knows (once-and-only-once). </pre> </blockquote> <pre wrap=""><!----> Constraints are meant to provide flexibility. E.g. there is an IsAnything constraint for when your test doesn't care about actual values.</pre> </blockquote> Could not the IsAnything take a Class as an argument? Or are you using IsAnything to cover multiple methods at once?<br> <blockquote type="cite" cite="mid...@ba..."> <pre wrap=""> Also, Constraints are invoked *after* the static type system and runtime type checking in the Reflection API has checked that types are correct, so there is no need for Constraints to specify more about types than is actually needed for the test.</pre> </blockquote> I'm not purposing invoking the constraint, but determining the Class's of the objects which are being constrained, using that to determine a specific Method. The purpose being to use Method as the key in MethodMap. <br> <br> But you have exhausted my knowlege of the dynamic mock code. I need to write tests and modify the dynamic mocks to see my actual requiremetns and the forces on the dynmic mock design.<br> <br> And thanks much for the feedback! It is helping me very much.<br> <br> -bk<br> <br> </body> </html> |