I need to simulate a test scenario in which I call the getBytes()
method of a String object and I get an UnsupportedEncodingException.
I have tried to achie
Mockito can't mock final classes. JMock, combined with a library from JDave can. Here are instructions.
JMock doesn't do anything special for final classes other than rely on the JDave library to unfinalize everything in the JVM, so you could experiment with using JDave's unfinalizer and see if Mockito will then mock it.