### Question:
Quintuple extends Quadruple<R, S, T, U> implements Fifth<V>,
                   MappableFifth<V, Quintuple<R, S, T, U, ?>> { @Override public <A> Quintuple<R, A, T, U, V> mapSecond(UnaryFunction<S, A> function) { return quintuple(getFirst(), function.call(getSecond()), getThird(), getFourth(), getFifth()); } Quintuple(R first, S second, T third, U fourth, V fifth); static Quintuple<R, S, T, U, V> quintuple(R first, S second, T third, U fourth, V fifth); @Override V getFifth(); @Override Quintuple<A, S, T, U, V> mapFirst(UnaryFunction<R, A> function); @Override Quintuple<R, A, T, U, V> mapSecond(UnaryFunction<S, A> function); @Override Quintuple<R, S, A, U, V> mapThird(UnaryFunction<T, A> function); @Override Quintuple<R, S, T, A, V> mapFourth(UnaryFunction<U, A> function); @Override Quintuple<R, S, T, U, A> mapFifth(UnaryFunction<V, A> function); @Override Iterable<Object> getValues();  }### Answer:
@Test public void shouldBeMappableUsingMapperOnSecondPosition() throws Exception { Quintuple<Integer, String, Boolean, Double, Long> quintuple = tuple(5, "Five", true, 3.6, 2L); Mapper<String, Integer> mapper = new Mapper<String, Integer>() { @Override public Integer map(String input) { return input.length(); } }; Quintuple<Integer, Integer, Boolean, Double, Long> expected = tuple(5, 4, true, 3.6, 2L); Quintuple<Integer, Integer, Boolean, Double, Long> actual = quintuple.mapSecond(mapper); assertThat(actual, is(expected)); }
@Test(expected = NullPointerException.class) public void shouldThrowNullPointerExceptionIfNullMapperPassedToMapSecond() throws Exception { Quintuple<Integer, String, Boolean, Double, Long> quintuple = tuple(5, "Five", true, 3.6, 2L); Mapper<String, Integer> mapper = null; quintuple.mapSecond(mapper); }
@Test public void shouldBeMappableUsingUnaryFunctionOnSecondPosition() throws Exception { Quintuple<Integer, String, Boolean, Double, Long> quintuple = tuple(5, "Five", true, 3.6, 2L); UnaryFunction<String, Integer> function = new UnaryFunction<String, Integer>() { @Override public Integer call(String input) { return input.length(); } }; Quintuple<Integer, Integer, Boolean, Double, Long> expected = tuple(5, 4, true, 3.6, 2L); Quintuple<Integer, Integer, Boolean, Double, Long> actual = quintuple.mapSecond(function); assertThat(actual, is(expected)); }
@Test(expected = NullPointerException.class) public void shouldThrowNullPointerExceptionIfNullUnaryFunctionPassedToMapSecond() throws Exception { Quintuple<Integer, String, Boolean, Double, Long> quintuple = tuple(5, "Five", true, 3.6, 2L); UnaryFunction<String, Integer> function = null; quintuple.mapSecond(function); }