Mock API helps to create dummy object and returns back something to program when we are calling any method on that dummy object instead calling actual object.
Ex:
You can find very good example with maven integration in the below link.
http://onjavahell.blogspot.in/2009/05/good-unit-testing-with-jmock.html
Ex:
context.checking(new Expectations() {{ oneOf (accountDAO).selectAccount(with("1234")); will(returnValue(null)); }});
Here we are asking Mock api return "null" value when I Call selectAccount method with 1234 value on AccountDAO object.
You can find very good example with maven integration in the below link.
http://onjavahell.blogspot.in/2009/05/good-unit-testing-with-jmock.html
1 comment:
thanks
Post a Comment