I have a class that has an explicit initialization method and some other methods that do the actual work:
public class Worker {
public void init(Context context) { /* ... */ };
public void doWork() { /* ... */ };
}
The Init method must be called before any actual work is done, which is documented in class and methods description.
I would like to throw an exception from DoWork method if initialization wasn't performed before the call. What would be the right exception type for this case? UnsupportedOperationException, IllegalStateException or something else?