Class Rethrow

java.lang.Object
nl.jqno.equalsverifier.internal.util.Rethrow

public final class Rethrow extends Object
Utilities for catching checked exceptions and re-throwing them as a RuntimeException.

Java's reflection API declares lots of checked exceptions that it rarely actually throws, if ever. We still need to catch all of them, but the code in the catch blocks is never executed. It is hard to create tests to do so. Besides, EqualsVerifier contains a lot of extra checks to make sure these cases can never occur.

This adds a lot of noise to the test coverage and mutation coverage reports, that needs to be inspected manually every time. This makes me too lazy to actually do it, which is how needless gaps in coverage accumulate. By using Rethrow, we can easily cover the exception code, making gaps in coverage actual gaps in coverage that need to be dealt with instead of ignored over and over.

As a nice side effect, it makes it easier to increase the coverage threshold even more, though this is not the purpose of this class.