Package org.djunits.quantity
Class TorqueTest
java.lang.Object
org.djunits.quantity.TorqueTest
TorqueTest tests the Torque quantity class.
This test suite verifies:
- Constructors, constants, copy behavior, and SI conversions
- String parsing and all parsing-related error branches
- Arithmetic operations (divide and multiply) producing correct quantities
- Unit conversions, including imperial units (lbf·ft, lbf·in) and kilogram-force meters
- Unit derivation behavior—including linear unit derivation and the exception path for non-linear scale derivation
- Proper resolution of units through the Units registry
- Author:
- Alexander Verbraeck (specifications); Test implementation by Copilot.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final voidsetup()Set a predictable locale before each test.(package private) voidTest constructors, constants, string parsing, SI conversions, instantiate, siUnit(), and ofSi().(package private) voidTest all arithmetic operations provided by Torque.(package private) voidTest all parsing error branches: null, empty, unknown unit, malformed numeric value, and of() error paths.(package private) voidTest unit derivation.(package private) voidTest correctness of unit conversions for Nm, meter-kilogram-force, pound-foot, and pound-inch.
-
Constructor Details
-
TorqueTest
TorqueTest()
-
-
Method Details
-
setup
@BeforeEach final void setup()Set a predictable locale before each test. -
testBasics
@Test void testBasics()Test constructors, constants, string parsing, SI conversions, instantiate, siUnit(), and ofSi(). -
testParsingErrors
@Test void testParsingErrors()Test all parsing error branches: null, empty, unknown unit, malformed numeric value, and of() error paths. -
testUnitConversions
@Test void testUnitConversions()Test correctness of unit conversions for Nm, meter-kilogram-force, pound-foot, and pound-inch. Also verifies registry resolution behavior. -
testOperations
@Test void testOperations()Test all arithmetic operations provided by Torque.- divide(Torque)
- divide(Force) → Length
- divide(Length) → Force
- multiply(LinearObjectDensity) → Force
- divide(Duration) → Power
- divide(Power) → Duration
- multiply(Frequency) → Power
- divide(Volume) → Pressure
- divide(Pressure) → Volume
-
testUnitBehavior
@Test void testUnitBehavior()Test unit derivation.- Deriving a linear unit
- Exception branch for non-linear scale derivation
- ofSi delegation
-