@Test
  public void testGetOptionValueOrDefault_ConversionFailure() throws Exception {
    when(defaultValueProvider.defaultValue(optionSpec)).thenReturn(DEFAULT_VALUE);

    CommandLine.ITypeConverter<Integer> failingConverter =
        value -> {
          throw new Exception("Conversion failed");
        };

    String actualMessage =
        assertThrows(
                RuntimeException.class,
                () -> getOptionValueOrDefault(commandLine, OPTION_NAME, failingConverter))
            .getMessage();
    final String expectedMessage =
        "Failed to convert default value for option option: Conversion failed";
    assertThat(actualMessage).isEqualTo(expectedMessage);
  }
Unit tests for {@link CommandLineUtils} focusing on the retrieval of option values
(getOptionValueOrDefault).
app/src/test/java/org/hyperledger/besu/cli/CommandLineUtilsDefaultsTest.java