Package org.djunits.quantity
Class VolumeTest
java.lang.Object
org.djunits.quantity.VolumeTest
VolumeTest tests the Volume quantity class.
This test suite verifies:
- Constructors, constants, copy behavior, and SI conversions
- Class-specific String parsing behavior (success + error branches)
- Arithmetic operations producing correct result quantities
- Unit conversions for SI, SI-derived, imperial/US customary, and astronomical units
- Unit derivation behavior (linear + non-linear exception path)
- Units registry resolution sanity
- 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 valueOf/of error branches with the custom Throw/NumberParser logic.(package private) voidTest unit derivation behavior.(package private) voidTest a selection of unit conversions (SI, SI-derived, imperial/US customary, astronomical), and registry resolution sanity.(package private) voidTest constructors, constants, parsing, SI conversions, instantiate, siUnit(), and ofSi().(package private) voidTest arithmetic operations: divide(Volume) → Dimensionless (incl. divide-by-zero) multiply(Density) → Mass multiply(Pressure) → Energy divide(Length) → Area divide(Area) → Length multiply(LinearObjectDensity) → Area divide(Duration) → FlowVolume divide(FlowVolume) → Duration reciprocal() → VolumetricObjectDensity
-
Constructor Details
-
VolumeTest
VolumeTest()
-
-
Method Details
-
setup
@BeforeEach final void setup()Set a predictable locale before each test. -
testVolumeBasics
@Test void testVolumeBasics()Test constructors, constants, parsing, SI conversions, instantiate, siUnit(), and ofSi(). -
testParsingErrorBranches
@Test void testParsingErrorBranches()Test valueOf/of error branches with the custom Throw/NumberParser logic. -
testUnitConversionsAndRegistry
@Test void testUnitConversionsAndRegistry()Test a selection of unit conversions (SI, SI-derived, imperial/US customary, astronomical), and registry resolution sanity. -
testVolumeOperations
@Test void testVolumeOperations()Test arithmetic operations:- divide(Volume) → Dimensionless (incl. divide-by-zero)
- multiply(Density) → Mass
- multiply(Pressure) → Energy
- divide(Length) → Area
- divide(Area) → Length
- multiply(LinearObjectDensity) → Area
- divide(Duration) → FlowVolume
- divide(FlowVolume) → Duration
- reciprocal() → VolumetricObjectDensity
-
testUnitBehavior
@Test void testUnitBehavior()Test unit derivation behavior. This includes:- Linear derivation from m3
- Non-linear derivation exception path
- Unit.ofSi delegation
-