guru.mocker.java.internal.result.ExceptionResult Maven / Gradle / Ivy
The newest version!
package guru.mocker.java.internal.result;
import static guru.mocker.java.api.util.TestFrameworkUtil.fail;
import static org.hamcrest.MatcherAssert.assertThat;
public record ExceptionResult(Throwable result) implements Result
{
@Override
public void assertEqual(Result realResult)
{
assertThrowables(result, realResult.result());
}
private static void assertThrowables(Throwable throwableByMock, Throwable throwableByReal)
{
assertThat("Expected to be thrown the same class or subclass",
throwableByMock.getClass().isAssignableFrom(throwableByReal.getClass()));
}
@Override
public void assertionFailed(Result> realResult)
{
fail("Exception expected to be thrown", result);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy