
com.foursoft.vecmodel.vec120.AbstractVecNURBSControlPointAssert Maven / Gradle / Ivy
Show all versions of vec120-assertions Show documentation
package com.foursoft.vecmodel.vec120;
import org.assertj.core.api.AbstractObjectAssert;
import org.assertj.core.api.Assertions;
import org.assertj.core.util.Objects;
/**
* Abstract base class for {@link VecNURBSControlPoint} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
public abstract class AbstractVecNURBSControlPointAssert, A extends VecNURBSControlPoint> extends AbstractObjectAssert {
/**
* Creates a new {@link AbstractVecNURBSControlPointAssert}
to make assertions on actual VecNURBSControlPoint.
* @param actual the VecNURBSControlPoint we want to make assertions on.
*/
protected AbstractVecNURBSControlPointAssert(A actual, Class selfType) {
super(actual, selfType);
}
/**
* Verifies that the actual VecNURBSControlPoint's cartesianPoint3D is equal to the given one.
* @param cartesianPoint3D the given cartesianPoint3D to compare the actual VecNURBSControlPoint's cartesianPoint3D to.
* @return this assertion object.
* @throws AssertionError - if the actual VecNURBSControlPoint's cartesianPoint3D is not equal to the given one.
*/
public S hasCartesianPoint3D(VecCartesianPoint3D cartesianPoint3D) {
// check that actual VecNURBSControlPoint we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting cartesianPoint3D of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
VecCartesianPoint3D actualCartesianPoint3D = actual.getCartesianPoint3D();
if (!Objects.areEqual(actualCartesianPoint3D, cartesianPoint3D)) {
failWithMessage(assertjErrorMessage, actual, cartesianPoint3D, actualCartesianPoint3D);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecNURBSControlPoint's parentNURBSCurve is equal to the given one.
* @param parentNURBSCurve the given parentNURBSCurve to compare the actual VecNURBSControlPoint's parentNURBSCurve to.
* @return this assertion object.
* @throws AssertionError - if the actual VecNURBSControlPoint's parentNURBSCurve is not equal to the given one.
*/
public S hasParentNURBSCurve(VecNURBSCurve parentNURBSCurve) {
// check that actual VecNURBSControlPoint we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting parentNURBSCurve of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
VecNURBSCurve actualParentNURBSCurve = actual.getParentNURBSCurve();
if (!Objects.areEqual(actualParentNURBSCurve, parentNURBSCurve)) {
failWithMessage(assertjErrorMessage, actual, parentNURBSCurve, actualParentNURBSCurve);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecNURBSControlPoint's weight is equal to the given one.
* @param weight the given weight to compare the actual VecNURBSControlPoint's weight to.
* @return this assertion object.
* @throws AssertionError - if the actual VecNURBSControlPoint's weight is not equal to the given one.
*/
public S hasWeight(double weight) {
// check that actual VecNURBSControlPoint we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting weight of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// check value for weight
double actualWeight = actual.getWeight();
if (actualWeight != weight) {
failWithMessage(assertjErrorMessage, actual, weight, actualWeight);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecNURBSControlPoint's weight 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 weight the value to compare the actual VecNURBSControlPoint's weight to.
* @param assertjOffset the given offset.
* @return this assertion object.
* @throws AssertionError - if the actual VecNURBSControlPoint's weight is not close enough to the given value.
*/
public S hasWeightCloseTo(double weight, double assertjOffset) {
// check that actual VecNURBSControlPoint we want to make assertions on is not null.
isNotNull();
double actualWeight = actual.getWeight();
// overrides the default error message with a more explicit one
String assertjErrorMessage = String.format("\nExpecting weight:\n <%s>\nto be close to:\n <%s>\nby less than <%s> but difference was <%s>",
actualWeight, weight, assertjOffset, Math.abs(weight - actualWeight));
// check
Assertions.assertThat(actualWeight).overridingErrorMessage(assertjErrorMessage).isCloseTo(weight, Assertions.within(assertjOffset));
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecNURBSControlPoint's xmlId is equal to the given one.
* @param xmlId the given xmlId to compare the actual VecNURBSControlPoint's xmlId to.
* @return this assertion object.
* @throws AssertionError - if the actual VecNURBSControlPoint's xmlId is not equal to the given one.
*/
public S hasXmlId(String xmlId) {
// check that actual VecNURBSControlPoint we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting xmlId of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
String actualXmlId = actual.getXmlId();
if (!Objects.areEqual(actualXmlId, xmlId)) {
failWithMessage(assertjErrorMessage, actual, xmlId, actualXmlId);
}
// return the current assertion for method chaining
return myself;
}
}