Wednesday, 15 June 2011

java - How can I test idempotency of a method with junit? -



java - How can I test idempotency of a method with junit? -

i have create test idempotency of method.

let have class person next method:

public string dosomething(string a){ //do stuff persondao.delete(a) }

and need test when goes wrong before delete next time phone call method dosomething create same result wanted when should have run correctly first time. happen illustration when run script calls method fails illustration stopping script. when run script next time should have give same result without failure.

can in unit test?

thanks in advance

the test should run method twice. outcome / results should identical in both cases. it's simple really.

pseudocode:

setupexception(); dosomething(a); assertoutcome(); dosomething(a); assertoutcome();

java junit mockito idempotent

No comments:

Post a Comment