FilterOptions implements IAnnotation { public void getBoolean(String key, Consumer<Boolean> consumer) { if (this.options.containsKey(key)) { consumer.accept(Boolean.valueOf(this.options.get(key))); } } FilterOptions(List<String> options); void getString(String key, Consumer<String> consumer); void getBoolean(String key, Consumer<Boolean> consumer);  }
@Test public void testGetBoolean() { FilterOptions filterOptions = new FilterOptions(Arrays.asList("option1=true", "option2=false")); AtomicBoolean called = new AtomicBoolean(false); filterOptions.getBoolean("option1", v -> { called.set(true); assertTrue(v); }); filterOptions.getBoolean("option2", v -> { called.set(true); assertFalse(v); }); assertTrue(called.get()); }