FilterOptions implements IAnnotation { public void getString(String key, Consumer<String> consumer) { if (this.options.containsKey(key)) { consumer.accept(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 testSplit() { FilterOptions filterOptions = new FilterOptions(Arrays.asList("option1=value1", "option2=value2")); AtomicBoolean called = new AtomicBoolean(false); filterOptions.getString("option1", v -> { called.set(true); assertEquals("value1", v); }); filterOptions.getString("option2", v -> { called.set(true); assertEquals("value2", v); }); assertTrue(called.get()); }
@Test public void testSetObjectVariable() { FilterOptions filterOptions = new FilterOptions(Arrays.asList("option1=someobjectvalue")); filterOptions.getString("option1", v -> forTestSetObjectVariable = v); assertEquals("someobjectvalue", forTestSetObjectVariable); }