
com.foursoft.vecmodel.vec120.AbstractVecToleranceAssert Maven / Gradle / Ivy
Show all versions of vec120-assertions Show documentation
package com.foursoft.vecmodel.vec120;
import org.assertj.core.api.Assertions;
import org.assertj.core.util.Objects;
/**
* Abstract base class for {@link VecTolerance} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
public abstract class AbstractVecToleranceAssert, A extends VecTolerance> extends AbstractVecExtendableElementAssert {
/**
* Creates a new {@link AbstractVecToleranceAssert}
to make assertions on actual VecTolerance.
* @param actual the VecTolerance we want to make assertions on.
*/
protected AbstractVecToleranceAssert(A actual, Class selfType) {
super(actual, selfType);
}
/**
* Verifies that the actual VecTolerance's lowerBoundary is equal to the given one.
* @param lowerBoundary the given lowerBoundary to compare the actual VecTolerance's lowerBoundary to.
* @return this assertion object.
* @throws AssertionError - if the actual VecTolerance's lowerBoundary is not equal to the given one.
*/
public S hasLowerBoundary(double lowerBoundary) {
// check that actual VecTolerance we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting lowerBoundary of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// check value for lowerBoundary
double actualLowerBoundary = actual.getLowerBoundary();
if (actualLowerBoundary != lowerBoundary) {
failWithMessage(assertjErrorMessage, actual, lowerBoundary, actualLowerBoundary);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecTolerance's lowerBoundary is close to the given value by less than the given offset.
*
* If difference is equal to the offset value, assertion is considered successful.
* @param lowerBoundary the value to compare the actual VecTolerance's lowerBoundary to.
* @param assertjOffset the given offset.
* @return this assertion object.
* @throws AssertionError - if the actual VecTolerance's lowerBoundary is not close enough to the given value.
*/
public S hasLowerBoundaryCloseTo(double lowerBoundary, double assertjOffset) {
// check that actual VecTolerance we want to make assertions on is not null.
isNotNull();
double actualLowerBoundary = actual.getLowerBoundary();
// overrides the default error message with a more explicit one
String assertjErrorMessage = String.format("\nExpecting lowerBoundary:\n <%s>\nto be close to:\n <%s>\nby less than <%s> but difference was <%s>",
actualLowerBoundary, lowerBoundary, assertjOffset, Math.abs(lowerBoundary - actualLowerBoundary));
// check
Assertions.assertThat(actualLowerBoundary).overridingErrorMessage(assertjErrorMessage).isCloseTo(lowerBoundary, Assertions.within(assertjOffset));
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecTolerance's parentDefaultDimension is equal to the given one.
* @param parentDefaultDimension the given parentDefaultDimension to compare the actual VecTolerance's parentDefaultDimension to.
* @return this assertion object.
* @throws AssertionError - if the actual VecTolerance's parentDefaultDimension is not equal to the given one.
*/
public S hasParentDefaultDimension(VecDefaultDimension parentDefaultDimension) {
// check that actual VecTolerance we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting parentDefaultDimension of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
VecDefaultDimension actualParentDefaultDimension = actual.getParentDefaultDimension();
if (!Objects.areEqual(actualParentDefaultDimension, parentDefaultDimension)) {
failWithMessage(assertjErrorMessage, actual, parentDefaultDimension, actualParentDefaultDimension);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecTolerance's parentDimension is equal to the given one.
* @param parentDimension the given parentDimension to compare the actual VecTolerance's parentDimension to.
* @return this assertion object.
* @throws AssertionError - if the actual VecTolerance's parentDimension is not equal to the given one.
*/
public S hasParentDimension(VecDimension parentDimension) {
// check that actual VecTolerance we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting parentDimension of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
VecDimension actualParentDimension = actual.getParentDimension();
if (!Objects.areEqual(actualParentDimension, parentDimension)) {
failWithMessage(assertjErrorMessage, actual, parentDimension, actualParentDimension);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecTolerance's parentNumericalValue is equal to the given one.
* @param parentNumericalValue the given parentNumericalValue to compare the actual VecTolerance's parentNumericalValue to.
* @return this assertion object.
* @throws AssertionError - if the actual VecTolerance's parentNumericalValue is not equal to the given one.
*/
public S hasParentNumericalValue(VecNumericalValue parentNumericalValue) {
// check that actual VecTolerance we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting parentNumericalValue of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
VecNumericalValue actualParentNumericalValue = actual.getParentNumericalValue();
if (!Objects.areEqual(actualParentNumericalValue, parentNumericalValue)) {
failWithMessage(assertjErrorMessage, actual, parentNumericalValue, actualParentNumericalValue);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecTolerance's upperBoundary is equal to the given one.
* @param upperBoundary the given upperBoundary to compare the actual VecTolerance's upperBoundary to.
* @return this assertion object.
* @throws AssertionError - if the actual VecTolerance's upperBoundary is not equal to the given one.
*/
public S hasUpperBoundary(double upperBoundary) {
// check that actual VecTolerance we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting upperBoundary of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// check value for upperBoundary
double actualUpperBoundary = actual.getUpperBoundary();
if (actualUpperBoundary != upperBoundary) {
failWithMessage(assertjErrorMessage, actual, upperBoundary, actualUpperBoundary);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecTolerance's upperBoundary is close to the given value by less than the given offset.
*
* If difference is equal to the offset value, assertion is considered successful.
* @param upperBoundary the value to compare the actual VecTolerance's upperBoundary to.
* @param assertjOffset the given offset.
* @return this assertion object.
* @throws AssertionError - if the actual VecTolerance's upperBoundary is not close enough to the given value.
*/
public S hasUpperBoundaryCloseTo(double upperBoundary, double assertjOffset) {
// check that actual VecTolerance we want to make assertions on is not null.
isNotNull();
double actualUpperBoundary = actual.getUpperBoundary();
// overrides the default error message with a more explicit one
String assertjErrorMessage = String.format("\nExpecting upperBoundary:\n <%s>\nto be close to:\n <%s>\nby less than <%s> but difference was <%s>",
actualUpperBoundary, upperBoundary, assertjOffset, Math.abs(upperBoundary - actualUpperBoundary));
// check
Assertions.assertThat(actualUpperBoundary).overridingErrorMessage(assertjErrorMessage).isCloseTo(upperBoundary, Assertions.within(assertjOffset));
// return the current assertion for method chaining
return myself;
}
}