### Question:
ConnectorOptions { public static String extractOption(Map<String, ?> options, String key, String defaultValue) { if (options == null) { return defaultValue; } return Optional.ofNullable(options.get(key)) .map(Object::toString) .filter(v -> v.length() > 0) .orElse(defaultValue); } private  ConnectorOptions(); static String extractOption(Map<String, ?> options, String key, String defaultValue); static String extractOption(Map<String, ?> options, String key); static String popOption(Map<String, ?> options, String key); static T extractOptionAndMap(Map<String, ?> options, String key,
                                                                    Function<? super String, T> mappingFn, T defaultValue); static T extractOptionAndMap(Map<String, ?> options, String key,
                                                                    Function<? super String, T> mappingFn); static void extractOptionAndConsume(Map<String, ?> options, String key,
                                                                   Consumer<String> consumer); static T extractOptionAsType(Map<String, ?> options,
                                                            String key, Class<T> requiredClass, T defaultValue); static T extractOptionAsType(Map<String, ?> options,
                                                            String key, Class<T> requiredClass);  }### Answer:
@Test public void testStringValue() { put(key, value); assertEquals(value, ConnectorOptions.extractOption(parameters, key)); assertNull(ConnectorOptions.extractOption(parameters, missingKey)); }
@Test public void testStringValueWithDefault() { String defaultValue = "defaultValue"; put(key, value); assertEquals(value, ConnectorOptions.extractOption(parameters, key, defaultValue)); assertEquals(defaultValue, ConnectorOptions.extractOption(parameters, missingKey, defaultValue)); }