@Test
public void testForeach() {

  final Integer[] r = new Integer[1];
  final Function<String, Option<Integer>> f = Options.foreach(new Function<String, Option<Integer>>() {
    @Override
    public Option<Integer> apply(String s) {
      return s.length() > 0 ? some(s.length()) : none(Integer.class);
    }
  }, new Effect<Integer>() {
    @Override
    protected void run(Integer integer) {
      r[0] = integer;
    }
  });
  assertEquals(none(Integer.class), f.apply(""));
  assertNull(r[0]);
  assertEquals(some(3), f.apply("bla"));
  assertEquals(new Integer(3), r[0]);
}