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


I have to do idempotency of a method.

Let us know that I have a class person with the following method:

  public string doSomething (string A) {// Some person's stuff dao. Delete (A)}   

And I need a test when something goes wrong before forgetting, the next time you call the method, something will make the same result as you When you wanted to walk the right way first. This might be for example when you run the script that calls the method, but stops the script to fail for example.

Can you do this in a unit test?

Thank you in advance

/ div>

take the exam The bar method should be run. The result / result should be similar in both cases. It's really that simple.

Pseudocode:

  setupException (); DoSomething (a); AssertOutcome (); DoSomething (a); AssertOutcome ();    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -