Class PressureFormatterTest

java.lang.Object
com.irurueta.units.PressureFormatterTest

class PressureFormatterTest extends Object
  • Field Details

    • VALUE

      private static final double VALUE
      Value used when formatting without conversion.
      See Also:
    • FRACTION_DIGITS

      private static final int FRACTION_DIGITS
      Maximum fraction digits used to get deterministic output.
      See Also:
    • SPAIN

      private static final Locale SPAIN
      Spanish locale (metric, decimal comma).
    • US

      private static final Locale US
      US locale (imperial, decimal point).
  • Constructor Details

    • PressureFormatterTest

      PressureFormatterTest()
  • Method Details

    • constructor_whenEmpty_usesDefaultLocale

      @Test void constructor_whenEmpty_usesDefaultLocale()
      Checks the default constructor.
    • constructor_whenLocale_usesLocale

      @Test void constructor_whenLocale_usesLocale()
      Checks the constructor with locale.
    • constructor_whenNullLocale_throwsIllegalArgumentException

      @Test void constructor_whenNullLocale_throwsIllegalArgumentException()
      Checks that a null locale is rejected.
    • constructor_whenFormatter_copiesLocale

      @Test void constructor_whenFormatter_copiesLocale()
      Checks the copy constructor.
    • constructor_whenNullFormatter_throwsNullPointerException

      @Test void constructor_whenNullFormatter_throwsNullPointerException()
      Checks that a null formatter is rejected by the copy constructor.
    • clone_whenCalled_returnsEqualButDifferentInstance

      @Test void clone_whenCalled_returnsEqualButDifferentInstance() throws CloneNotSupportedException
      Checks cloning before and after the internal number format is initialized.
      Throws:
      CloneNotSupportedException
    • equals_whenSameOrDifferentLocale_returnsExpectedResult

      @Test void equals_whenSameOrDifferentLocale_returnsExpectedResult()
      Checks equality and hash code.
    • format_whenAnyOverload_returnsValueAndSymbol

      @Test void format_whenAnyOverload_returnsValueAndSymbol()
      Checks formatting of every unit through all format overloads.
    • formatAndConvertMetric_whenDifferentMagnitudes_picksPascalKilopascalOrBar

      @Test void formatAndConvertMetric_whenDifferentMagnitudes_picksPascalKilopascalOrBar()
      Checks metric conversion thresholds.
    • formatAndConvertImperial_whenAnyUnit_returnsPsi

      @Test void formatAndConvertImperial_whenAnyUnit_returnsPsi()
      Checks that imperial conversion always uses psi.
    • formatAndConvert_whenUnitSystem_usesThatSystem

      @Test void formatAndConvert_whenUnitSystem_usesThatSystem()
      Checks conversion with an explicit unit system, for every overload.
    • formatAndConvert_whenNoUnitSystem_usesLocaleSystem

      @Test void formatAndConvert_whenNoUnitSystem_usesLocaleSystem()
      Checks conversion using the unit system of the formatter locale.
    • isValidUnit_whenKnownSymbol_returnsTrue

      @Test void isValidUnit_whenKnownSymbol_returnsTrue()
      Checks that validity checks recognize every unit symbol.
    • isValidMeasurement_whenKnownOrUnknownUnit_returnsExpectedResult

      @Test void isValidMeasurement_whenKnownOrUnknownUnit_returnsExpectedResult()
      Checks measurement validity, metric and imperial detection.
    • isMetricUnit_whenSource_returnsExpectedResult

      @Test void isMetricUnit_whenSource_returnsExpectedResult()
      Checks metric unit detection in strings.
    • isImperialUnit_whenSource_returnsExpectedResult

      @Test void isImperialUnit_whenSource_returnsExpectedResult()
      Checks imperial unit detection in strings.
    • getUnitSystem_whenSource_returnsDetectedSystem

      @Test void getUnitSystem_whenSource_returnsDetectedSystem()
      Checks unit system detection from strings.
    • getUnitSystem_whenNoSource_returnsLocaleSystem

      @Test void getUnitSystem_whenNoSource_returnsLocaleSystem()
      Checks that the formatter locale determines its default unit system.
    • parse_whenKnownUnit_returnsPressure

      @Test void parse_whenKnownUnit_returnsPressure() throws ParseException, UnknownUnitException
      Checks parsing of every unit, including kPa not being mistaken for Pa.
      Throws:
      ParseException
      UnknownUnitException
    • parse_whenUnknownUnit_throwsUnknownUnitException

      @Test void parse_whenUnknownUnit_throwsUnknownUnitException()
      Checks that an unknown unit fails parsing.
    • parse_whenNoNumber_throwsParseException

      @Test void parse_whenNoNumber_throwsParseException()
      Checks that a string without a number fails parsing.
    • findUnit_whenSource_returnsDetectedUnit

      @Test void findUnit_whenSource_returnsDetectedUnit()
      Checks unit detection in strings.
    • findUnit_whenUnsupportedPrefix_returnsNullAndParseFails

      @Test void findUnit_whenUnsupportedPrefix_returnsNullAndParseFails()
      Checks that unsupported prefixed units are rejected instead of being parsed as a supported unit.
    • getUnitSymbol_whenAnyUnit_returnsSymbol

      @Test void getUnitSymbol_whenAnyUnit_returnsSymbol()
      Checks unit symbols.