
com.foursoft.vecmodel.vec120.AbstractVecCartesianDimensionAssert 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 VecCartesianDimension} specific assertions - Generated by CustomAssertionGenerator.
*/
@javax.annotation.Generated(value="assertj-assertions-generator")
public abstract class AbstractVecCartesianDimensionAssert, A extends VecCartesianDimension> extends AbstractVecExtendableElementAssert {
/**
* Creates a new {@link AbstractVecCartesianDimensionAssert}
to make assertions on actual VecCartesianDimension.
* @param actual the VecCartesianDimension we want to make assertions on.
*/
protected AbstractVecCartesianDimensionAssert(A actual, Class selfType) {
super(actual, selfType);
}
/**
* Verifies that the actual VecCartesianDimension's height is equal to the given one.
* @param height the given height to compare the actual VecCartesianDimension's height to.
* @return this assertion object.
* @throws AssertionError - if the actual VecCartesianDimension's height is not equal to the given one.
*/
public S hasHeight(double height) {
// check that actual VecCartesianDimension we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting height of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// check value for height
double actualHeight = actual.getHeight();
if (actualHeight != height) {
failWithMessage(assertjErrorMessage, actual, height, actualHeight);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecCartesianDimension's height 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 height the value to compare the actual VecCartesianDimension's height to.
* @param assertjOffset the given offset.
* @return this assertion object.
* @throws AssertionError - if the actual VecCartesianDimension's height is not close enough to the given value.
*/
public S hasHeightCloseTo(double height, double assertjOffset) {
// check that actual VecCartesianDimension we want to make assertions on is not null.
isNotNull();
double actualHeight = actual.getHeight();
// overrides the default error message with a more explicit one
String assertjErrorMessage = String.format("\nExpecting height:\n <%s>\nto be close to:\n <%s>\nby less than <%s> but difference was <%s>",
actualHeight, height, assertjOffset, Math.abs(height - actualHeight));
// check
Assertions.assertThat(actualHeight).overridingErrorMessage(assertjErrorMessage).isCloseTo(height, Assertions.within(assertjOffset));
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecCartesianDimension's parentBuildingBlockSpecification2D is equal to the given one.
* @param parentBuildingBlockSpecification2D the given parentBuildingBlockSpecification2D to compare the actual VecCartesianDimension's parentBuildingBlockSpecification2D to.
* @return this assertion object.
* @throws AssertionError - if the actual VecCartesianDimension's parentBuildingBlockSpecification2D is not equal to the given one.
*/
public S hasParentBuildingBlockSpecification2D(VecBuildingBlockSpecification2D parentBuildingBlockSpecification2D) {
// check that actual VecCartesianDimension we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting parentBuildingBlockSpecification2D of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
VecBuildingBlockSpecification2D actualParentBuildingBlockSpecification2D = actual.getParentBuildingBlockSpecification2D();
if (!Objects.areEqual(actualParentBuildingBlockSpecification2D, parentBuildingBlockSpecification2D)) {
failWithMessage(assertjErrorMessage, actual, parentBuildingBlockSpecification2D, actualParentBuildingBlockSpecification2D);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecCartesianDimension's width is equal to the given one.
* @param width the given width to compare the actual VecCartesianDimension's width to.
* @return this assertion object.
* @throws AssertionError - if the actual VecCartesianDimension's width is not equal to the given one.
*/
public S hasWidth(double width) {
// check that actual VecCartesianDimension we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting width of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// check value for width
double actualWidth = actual.getWidth();
if (actualWidth != width) {
failWithMessage(assertjErrorMessage, actual, width, actualWidth);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual VecCartesianDimension's width 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 width the value to compare the actual VecCartesianDimension's width to.
* @param assertjOffset the given offset.
* @return this assertion object.
* @throws AssertionError - if the actual VecCartesianDimension's width is not close enough to the given value.
*/
public S hasWidthCloseTo(double width, double assertjOffset) {
// check that actual VecCartesianDimension we want to make assertions on is not null.
isNotNull();
double actualWidth = actual.getWidth();
// overrides the default error message with a more explicit one
String assertjErrorMessage = String.format("\nExpecting width:\n <%s>\nto be close to:\n <%s>\nby less than <%s> but difference was <%s>",
actualWidth, width, assertjOffset, Math.abs(width - actualWidth));
// check
Assertions.assertThat(actualWidth).overridingErrorMessage(assertjErrorMessage).isCloseTo(width, Assertions.within(assertjOffset));
// return the current assertion for method chaining
return myself;
}
}