### Question:
FunctionList extends TransformedList<S, E> implements RandomAccess { public void setReverseFunction(Function<E,S> reverse) { this.reverse = reverse; } FunctionList(EventList<S> source, Function<S,E> forward);  FunctionList(EventList<S> source, Function<S,E> forward, Function<E,S> reverse); void setForwardFunction(Function<S,E> forward); Function<S,E> getForwardFunction(); void setReverseFunction(Function<E,S> reverse); Function<E,S> getReverseFunction(); @Override void listChanged(ListEvent<S> listChanges); @Override E get(int index); @Override E remove(int index); @Override E set(int index, E value); @Override void add(int index, E value); @Override boolean removeIf(Predicate<? super E> filter);  }### Answer:
@Test public void testSetReverseFunction() { EventList<Integer> source = new BasicEventList<>(); FunctionList<Integer, String> intsToStrings = new FunctionList<>(source, new IntegerToString(), new StringToInteger()); ListConsistencyListener.install(intsToStrings); source.add(ZERO); assertEquals("0", intsToStrings.get(0)); intsToStrings.set(0, "1"); assertEquals(ONE, source.get(0)); intsToStrings.setForwardFunction(new IntegerToCardinalityString()); assertEquals("1st", intsToStrings.get(0)); try { intsToStrings.set(0, "2nd"); fail("failed to throw IllegalArgumentException when using out-of-date reverse function"); } catch (IllegalArgumentException e) { } intsToStrings.setReverseFunction(new CardinalityStringToInteger()); intsToStrings.set(0, "2nd"); assertEquals(TWO, source.get(0)); intsToStrings.setReverseFunction(null); try { intsToStrings.set(0, "9th"); fail("failed to throw IllegalStateException when using a null reverse function to write thru a FunctionList"); } catch (IllegalStateException e) { } }