@Test
    public void testThrowsExceptionIfTryingToParseInvalidStringForEnum() {
        final ConfigOption<String> configOption = createStringConfigOption();

        final Configuration configuration = new Configuration();
        final String invalidValueForTestEnum = "InvalidValueForTestEnum";
        configuration.setString(configOption.key(), invalidValueForTestEnum);

        try {
            configuration.getEnum(TestEnum.class, configOption);
            fail("Expected exception not thrown");
        } catch (IllegalArgumentException e) {
            final String expectedMessage = "Value for config option "
                    + configOption.key() + " must be one of [VALUE1, VALUE2] (was "
                    + invalidValueForTestEnum + ")";
            assertThat(e.getMessage(), containsString(expectedMessage));
        }
    }
This test checks the serialization/deserialization of configuration objects.
inlong-sort/sort-common/src/test/java/org/apache/inlong/sort/configuration/ConfigurationTest.java