I am trying to reach high % coverage using EclEmma on a piece of code and I am having problem covering the following:
public class foo() {
ReadWriteLock compositeLock;
@VisibleForTesting
@Guardedby("compositeLock")
public class String far() {
compositeLock.getLock().unlock();
try {
//code..
return answer;
} finally {
compositeLock.getLock().lock();
}
}
}
I am missing coverage on the finally
part, should I use mockito and mock the ReadWriteLock? Or is mocking not needed?