easyforgood / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

Enable external to be plugged in at stub time to enable, for example to support JSR-303 annotations on methods and parameters of mocks and spies #425

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I've forked the Git repository and am adding new static methods mockValid() and 
spyValid() to the Mockito class to return a mock/spy that will enforce 
constraints on the parameters and return types defined on the methods of the 
mock/spy.  

Note: The idea is NOT to bypass using JSR-303 in your unit tests. Tests should 
still use validator.validate() to make sure beans et al are valid (and the 
validations are tested). The purpose is only to ensure that the mocks and spies 
are receiving valid parameters from (and have been configured to return valid 
results to) the class under test, to ensure the class under test fulfills the 
contract. 

Original issue reported on code.google.com by b...@koehn.com on 7 Mar 2013 at 4:35

GoogleCodeExporter commented 8 years ago
Looking more closely I'll follow the pattern of using MockSettings and the 
existing mock() and spy() methods. 

Original comment by b...@koehn.com on 7 Mar 2013 at 5:02

GoogleCodeExporter commented 8 years ago
Pull request: https://github.com/mockito/mockito/pull/9

Original comment by b...@koehn.com on 7 Mar 2013 at 9:29

GoogleCodeExporter commented 8 years ago
After discussion with bric3 (see the pull request) I've made fairly substantial 
changes to the design of this solution and it's worthy of a look. No longer 
tied to JSR-303, it now improves the information available to Listeners et al. 

Original comment by b...@koehn.com on 14 Mar 2013 at 3:13

GoogleCodeExporter commented 8 years ago

Original comment by brice.du...@gmail.com on 29 Apr 2013 at 4:06

GoogleCodeExporter commented 8 years ago

Original comment by brice.du...@gmail.com on 29 Apr 2013 at 4:07