Write a method named retrieveValue
.
retrieveValue
takes an instance of Faulter
and returns the result of retrieving its value
property,
which has type Int
.
Seems simple!
Except there is just one small problem.
Faulter
was implemented by a friend that didn't take CS 124, and so it's getter is pretty buggy.
A lot of the time it will throw an exception rather than return the value.
But you did take CS 124, and so you know how to catch the exception and retry the call to getValue
.
Note that getValue
may fault multiple times before succeeding, and you should retry until it successfully
returns a value.
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: