Class VolumeTest

java.lang.Object
org.djunits.quantity.VolumeTest

class VolumeTest extends Object
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
Copyright (c) 2025-2026 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djunits.org. The DJUNITS project is distributed under a three-clause BSD-style license.
Author:
Alexander Verbraeck (specifications); Test implementation by Copilot.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) final void
    Set a predictable locale before each test.
    (package private) void
    Test valueOf/of error branches with the custom Throw/NumberParser logic.
    (package private) void
    Test unit derivation behavior.
    (package private) void
    Test a selection of unit conversions (SI, SI-derived, imperial/US customary, astronomical), and registry resolution sanity.
    (package private) void
    Test constructors, constants, parsing, SI conversions, instantiate, siUnit(), and ofSi().
    (package private) void
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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