### Question:
ConnectorOptions { public static void extractOptionAndConsume(Map<String, ?> options, String key, Consumer<String> consumer) { if (options == null) { return; } try { Optional.ofNullable(options.get(key)) .map(Object::toString) .ifPresent(consumer); } catch (Exception ex) { LOG.error("Evaluation of option '" + key + "' failed.", ex); } } 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 testValueAndConsumer() { put(key, value); final int[] cRun = new int[1]; final int[] success = new int[1]; Consumer<String> c = (String v) -> { cRun[0] = 1; if (v.equals(value)) { success[0] = 1; } }; cRun[0] = 0; success[0] = 0; ConnectorOptions.extractOptionAndConsume(parameters, key, c); assertEquals(1, cRun[0]); assertEquals(1, success[0]); cRun[0] = 0; success[0] = 0; ConnectorOptions.extractOptionAndConsume(parameters, missingKey, c); assertEquals(0, cRun[0]); assertEquals(0, success[0]); }