@Test public void canAdaptFunction() { final Function<Triple<O, O, O>, Triple<O, O, O>> function = Function.identity(); final TriFunction<O, O, O, Triple<O, O, O>> adapted = Tuples.Triples.untupled(function); Triple<O, O, O> got = adapted.apply(O.ONE, O.ONE, O.ONE); Assert.assertEquals(Triple.of(O.ONE, O.ONE, O.ONE), got); }
@Test public void canAdaptConsumer() { final Box<Triple<O, O, O>> box = Box.empty(); final Consumer<Triple<O, O, O>> consumer = Spies.spy(new Noop<Triple<O, O, O>>(), box); final TriConsumer<O, O, O> adapted = Tuples.Triples.untupled(consumer); adapted.accept(O.ONE, O.ANOTHER, O.YET_ANOTHER); Assert.assertEquals(Triple.of(O.ONE, O.ANOTHER, O.YET_ANOTHER), box.getContent()); }
@Test public void canAdaptPredicate() { final Predicate<Triple<O, O, O>> predicate = new Always<Triple<O, O, O>>(); final TriPredicate<O, O, O> adapted = Tuples.Triples.untupled(predicate); Assert.assertTrue(adapted.test(O.IGNORED, O.IGNORED, O.IGNORED)); }