Package com.irurueta.units
Class ForceTest
java.lang.Object
com.irurueta.units.ForceTest
Unit tests for
Force.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intValue used to build a force with an arbitrary value.private static final doubleTolerance used when comparing floating point values.private static final doubleFirst value used in tests.private static final doubleSecond value used in tests. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidChecks in-place addition of a double value.(package private) voidChecks in-place addition of another force.(package private) voidChecks addition of another force storing the result in a provided instance.(package private) voidChecks in-place addition of a number value.(package private) voidChecks static addition of primitive values.(package private) voidChecks static addition of forces into a result instance.(package private) voidChecks static addition of numbers with different units.(package private) voidChecks addAndReturnNew with a double value.(package private) voidChecks addAndReturnNew with another force.(package private) voidChecks addAndReturnNew with a number value.(package private) voidChecks static addAndReturnNew of two forces.(package private) voidChecks that the empty constructor leaves value and unit unset.(package private) voidChecks that a null value or unit is rejected.(package private) voidChecks that the constructor with value and unit stores them.(package private) voidChecks equality semantics.(package private) voidChecks tolerance based equality, including unit conversion and null handling.(package private) voidChecks hash code semantics.(package private) voidChecks that a force survives a serialization round trip.(package private) voidChecks that a null unit is rejected.(package private) voidChecks getter and setter of unit.(package private) voidChecks that a null value is rejected.(package private) voidChecks getter and setter of value.(package private) voidChecks in-place subtraction of a double value.(package private) voidChecks in-place subtraction of another force.(package private) voidChecks subtraction of another force storing the result in a provided instance.(package private) voidChecks in-place subtraction of a number value.(package private) voidChecks static subtraction of primitive values.(package private) voidChecks static subtraction of forces into a result instance.(package private) voidChecks static subtraction of numbers with different units.(package private) voidChecks subtractAndReturnNew with a double value.(package private) voidChecks subtractAndReturnNew with another force.(package private) voidChecks subtractAndReturnNew with a number value.(package private) voidChecks static subtractAndReturnNew of two forces.
-
Field Details
-
ERROR
private static final double ERRORTolerance used when comparing floating point values.- See Also:
-
VALUE1
private static final double VALUE1First value used in tests.- See Also:
-
VALUE2
private static final double VALUE2Second value used in tests.- See Also:
-
ARBITRARY_VALUE
private static final int ARBITRARY_VALUEValue used to build a force with an arbitrary value.- See Also:
-
-
Constructor Details
-
ForceTest
ForceTest()
-
-
Method Details
-
constructor_whenEmpty_hasNoValueAndUnit
@Test void constructor_whenEmpty_hasNoValueAndUnit()Checks that the empty constructor leaves value and unit unset. -
constructor_whenValueAndUnit_storesThem
@Test void constructor_whenValueAndUnit_storesThem()Checks that the constructor with value and unit stores them. -
constructor_whenNullValueOrUnit_throwsIllegalArgumentException
@Test void constructor_whenNullValueOrUnit_throwsIllegalArgumentException()Checks that a null value or unit is rejected. -
equals_whenDifferentInstances_comparesValueAndUnit
@Test void equals_whenDifferentInstances_comparesValueAndUnit()Checks equality semantics. -
hashCode_whenDifferentInstances_isConsistentWithEquals
@Test void hashCode_whenDifferentInstances_isConsistentWithEquals()Checks hash code semantics. -
equals_whenTolerance_comparesAfterUnitConversion
@Test void equals_whenTolerance_comparesAfterUnitConversion()Checks tolerance based equality, including unit conversion and null handling. -
setValue_whenValid_updatesValue
@Test void setValue_whenValid_updatesValue()Checks getter and setter of value. -
setValue_whenNull_throwsIllegalArgumentException
@Test void setValue_whenNull_throwsIllegalArgumentException()Checks that a null value is rejected. -
setUnit_whenValid_updatesUnit
@Test void setUnit_whenValid_updatesUnit()Checks getter and setter of unit. -
setUnit_whenNull_throwsIllegalArgumentException
@Test void setUnit_whenNull_throwsIllegalArgumentException()Checks that a null unit is rejected. -
add_whenStaticDoubles_returnsConvertedSum
@Test void add_whenStaticDoubles_returnsConvertedSum()Checks static addition of primitive values. -
add_whenStaticNumbersWithDifferentUnits_returnsConvertedSum
@Test void add_whenStaticNumbersWithDifferentUnits_returnsConvertedSum()Checks static addition of numbers with different units. -
add_whenStaticForces_storesResultInProvidedInstance
@Test void add_whenStaticForces_storesResultInProvidedInstance()Checks static addition of forces into a result instance. -
addAndReturnNew_whenStaticForces_returnsNewForce
@Test void addAndReturnNew_whenStaticForces_returnsNewForce()Checks static addAndReturnNew of two forces. -
addAndReturnNew_whenDoubleValue_returnsNewForce
@Test void addAndReturnNew_whenDoubleValue_returnsNewForce()Checks addAndReturnNew with a double value. -
addAndReturnNew_whenNumberValue_returnsNewForce
@Test void addAndReturnNew_whenNumberValue_returnsNewForce()Checks addAndReturnNew with a number value. -
addAndReturnNew_whenForce_returnsNewForce
@Test void addAndReturnNew_whenForce_returnsNewForce()Checks addAndReturnNew with another force. -
add_whenDoubleValue_updatesInstance
@Test void add_whenDoubleValue_updatesInstance()Checks in-place addition of a double value. -
add_whenNumberValue_updatesInstance
@Test void add_whenNumberValue_updatesInstance()Checks in-place addition of a number value. -
add_whenForce_updatesInstance
@Test void add_whenForce_updatesInstance()Checks in-place addition of another force. -
add_whenForceAndResult_storesResultInProvidedInstance
@Test void add_whenForceAndResult_storesResultInProvidedInstance()Checks addition of another force storing the result in a provided instance. -
subtract_whenStaticDoubles_returnsConvertedDifference
@Test void subtract_whenStaticDoubles_returnsConvertedDifference()Checks static subtraction of primitive values. -
subtract_whenStaticNumbersWithDifferentUnits_returnsConvertedDifference
@Test void subtract_whenStaticNumbersWithDifferentUnits_returnsConvertedDifference()Checks static subtraction of numbers with different units. -
subtract_whenStaticForces_storesResultInProvidedInstance
@Test void subtract_whenStaticForces_storesResultInProvidedInstance()Checks static subtraction of forces into a result instance. -
subtractAndReturnNew_whenStaticForces_returnsNewForce
@Test void subtractAndReturnNew_whenStaticForces_returnsNewForce()Checks static subtractAndReturnNew of two forces. -
subtractAndReturnNew_whenDoubleValue_returnsNewForce
@Test void subtractAndReturnNew_whenDoubleValue_returnsNewForce()Checks subtractAndReturnNew with a double value. -
subtractAndReturnNew_whenNumberValue_returnsNewForce
@Test void subtractAndReturnNew_whenNumberValue_returnsNewForce()Checks subtractAndReturnNew with a number value. -
subtractAndReturnNew_whenForce_returnsNewForce
@Test void subtractAndReturnNew_whenForce_returnsNewForce()Checks subtractAndReturnNew with another force. -
subtract_whenDoubleValue_updatesInstance
@Test void subtract_whenDoubleValue_updatesInstance()Checks in-place subtraction of a double value. -
subtract_whenNumberValue_updatesInstance
@Test void subtract_whenNumberValue_updatesInstance()Checks in-place subtraction of a number value. -
subtract_whenForce_updatesInstance
@Test void subtract_whenForce_updatesInstance()Checks in-place subtraction of another force. -
subtract_whenForceAndResult_storesResultInProvidedInstance
@Test void subtract_whenForceAndResult_storesResultInProvidedInstance()Checks subtraction of another force storing the result in a provided instance. -
serialize_whenRoundTrip_returnsEqualInstance
@Test void serialize_whenRoundTrip_returnsEqualInstance() throws IOException, ClassNotFoundExceptionChecks that a force survives a serialization round trip.- Throws:
IOException- if serialization fails.ClassNotFoundException- if deserialization fails.
-