예제 #1
0
 @Test
 public void canAdaptBiConsumer() {
   final Box<O> first = Box.empty();
   final Box<O> second = Box.empty();
   final BiConsumer<O, O> spy = Spies.spy(new BinaryNoop<O, O>(), first, second);
   final Consumer<Pair<O, O>> consumer = Tuples.tupled(spy);
   consumer.accept(Pair.of(O.ONE, O.ANOTHER));
   Assert.assertEquals(O.ONE, first.getContent());
   Assert.assertEquals(O.ANOTHER, second.getContent());
 }
예제 #2
0
 @Test
 public void canAdaptTriConsumer() {
   final Box<O> first = Box.empty();
   final Box<O> second = Box.empty();
   final Box<O> third = Box.empty();
   final TriConsumer<O, O, O> spy = Spies.spy(new TernaryNoop<O, O, O>(), first, second, third);
   final Consumer<Triple<O, O, O>> consumer = Tuples.tupled(spy);
   consumer.accept(Triple.of(O.ONE, O.ANOTHER, O.YET_ANOTHER));
   Assert.assertEquals(O.ONE, first.getContent());
   Assert.assertEquals(O.ANOTHER, second.getContent());
   Assert.assertEquals(O.YET_ANOTHER, third.getContent());
 }