Package com.irurueta.units
Class ForceConverterTest
java.lang.Object
com.irurueta.units.ForceConverterTest
Unit tests for
ForceConverter.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final doubleTolerance used when comparing floating point values.private static final doubleNumber of newtons in 1 dyne.private static final doubleNumber of newtons in 1 kilogram-force.private static final doubleNumber of newtons in 1 kilonewton.private static final doubleNumber of newtons in 1 pound-force.private static final doubleRelative tolerance used when checking round trip conversions.private static final doubleValue used in conversions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidChecks that package-private constants match the expected conversion factors.(package private) voidChecks that converting between every pair of units matches going through newtons, and that a unit converted to itself is unchanged.(package private) voidChecks conversion of a force to the unit of an output instance.(package private) voidChecks conversion of a force storing the result in another instance.(package private) voidChecks in-place conversion of a force.(package private) voidChecks that a null number is rejected.(package private) voidChecks that a null unit is rejected.(package private) voidChecks conversion of a number value.(package private) voidChecks that converting back and forth recovers the original value.(package private) voidChecks well known equivalences between units.(package private) voidChecks conversion of a force returning a new instance.(package private) voidChecks newton and dyne conversions.(package private) voidChecks newton and kilogram-force conversions.(package private) voidChecks newton and kilonewton conversions.(package private) voidChecks newton and pound-force conversions.
-
Field Details
-
NEWTONS_PER_KILONEWTON
private static final double NEWTONS_PER_KILONEWTONNumber of newtons in 1 kilonewton.- See Also:
-
NEWTONS_PER_POUND_FORCE
private static final double NEWTONS_PER_POUND_FORCENumber of newtons in 1 pound-force.- See Also:
-
NEWTONS_PER_DYNE
private static final double NEWTONS_PER_DYNENumber of newtons in 1 dyne.- See Also:
-
NEWTONS_PER_KILOGRAM_FORCE
private static final double NEWTONS_PER_KILOGRAM_FORCENumber of newtons in 1 kilogram-force.- See Also:
-
VALUE
private static final double VALUEValue used in conversions.- See Also:
-
ERROR
private static final double ERRORTolerance used when comparing floating point values.- See Also:
-
ROUND_TRIP_ERROR
private static final double ROUND_TRIP_ERRORRelative tolerance used when checking round trip conversions.- See Also:
-
-
Constructor Details
-
ForceConverterTest
ForceConverterTest()
-
-
Method Details
-
constants_whenRead_matchExpectedFactors
@Test void constants_whenRead_matchExpectedFactors()Checks that package-private constants match the expected conversion factors. -
newtonToKilonewton_whenKnownValue_returnsExpectedResult
@Test void newtonToKilonewton_whenKnownValue_returnsExpectedResult()Checks newton and kilonewton conversions. -
newtonToPoundForce_whenKnownValue_returnsExpectedResult
@Test void newtonToPoundForce_whenKnownValue_returnsExpectedResult()Checks newton and pound-force conversions. -
newtonToDyne_whenKnownValue_returnsExpectedResult
@Test void newtonToDyne_whenKnownValue_returnsExpectedResult()Checks newton and dyne conversions. -
newtonToKilogramForce_whenKnownValue_returnsExpectedResult
@Test void newtonToKilogramForce_whenKnownValue_returnsExpectedResult()Checks newton and kilogram-force conversions. -
convert_whenWellKnownEquivalences_returnsExpectedValues
@Test void convert_whenWellKnownEquivalences_returnsExpectedValues()Checks well known equivalences between units. -
convert_whenDoubleAndAllUnitPairs_matchesConversionThroughNewtons
@Test void convert_whenDoubleAndAllUnitPairs_matchesConversionThroughNewtons()Checks that converting between every pair of units matches going through newtons, and that a unit converted to itself is unchanged. -
convert_whenRoundTrip_recoversOriginalValue
@Test void convert_whenRoundTrip_recoversOriginalValue()Checks that converting back and forth recovers the original value. -
convert_whenNumber_returnsExpectedValue
@Test void convert_whenNumber_returnsExpectedValue()Checks conversion of a number value. -
convert_whenNullNumber_throwsNullPointerException
@Test void convert_whenNullNumber_throwsNullPointerException()Checks that a null number is rejected. -
convert_whenNullUnit_throwsNullPointerException
@Test void convert_whenNullUnit_throwsNullPointerException()Checks that a null unit is rejected. -
convert_whenForceAndResult_storesResultInProvidedInstance
@Test void convert_whenForceAndResult_storesResultInProvidedInstance()Checks conversion of a force storing the result in another instance. -
convert_whenForceAndUnit_updatesInstance
@Test void convert_whenForceAndUnit_updatesInstance()Checks in-place conversion of a force. -
convertAndReturnNew_whenForce_returnsNewConvertedForce
@Test void convertAndReturnNew_whenForce_returnsNewConvertedForce()Checks conversion of a force returning a new instance. -
convert_whenForceAndOutputForce_usesOutputUnit
@Test void convert_whenForceAndOutputForce_usesOutputUnit()Checks conversion of a force to the unit of an output instance.
-