guru.mocker.java.internal.result.ComparableResult Maven / Gradle / Ivy
The newest version!
package guru.mocker.java.internal.result;
public record ComparableResult(Either mockResult, Either realResult)
{
public void compareResults()
{
if (bothValidResult())
mockValidResult().assertEqual(realValidResult());
else if(bothExceptionResult())
mockExceptionResult().assertEqual(realExceptionResult());
else if(mockIsValidResultButRealIsExceptionResult())
mockValidResult().assertionFailed(realExceptionResult());
else
mockExceptionResult().assertionFailed(realValidResult());
}
private ExceptionResult realExceptionResult()
{
return realResult.getRight();
}
private ExceptionResult mockExceptionResult()
{
return mockResult.getRight();
}
private ValidResult realValidResult()
{
return realResult.getLeft();
}
private ValidResult mockValidResult()
{
return mockResult.getLeft();
}
private boolean mockIsValidResultButRealIsExceptionResult()
{
return mockResult.isLeft() && realResult.isRight();
}
private boolean bothExceptionResult()
{
return mockResult.isRight() && realResult.isRight();
}
private boolean bothValidResult()
{
return mockResult.isLeft() && realResult.isLeft();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy