Exemplo n.º 1
0
  @Test
  public void switchDisableInStream() {

    List<Integer> list =
        AnyM.fromStream(Stream.of(1, 2, 3))
            .<Integer>bind(i -> i == 1 ? FeatureToggle.disable(i) : FeatureToggle.enable(i))
            .asSequence()
            .toList();

    assertThat(list, equalTo(Arrays.asList(2, 3)));
  }
Exemplo n.º 2
0
 @Test
 public void switchTest() {
   assertThat(
       AnyM.ofMonad(FeatureToggle.enable("hello world")).map(o -> "2" + o).asSequence().toList(),
       equalTo(Arrays.asList("2hello world")));
 }