### Question:
Exercise4 { static <A> List<A> reverse(final List<A> list) { return Lists.foldLeft(list, Collections.emptyList(), (reversedList, item) -> Lists.prepend(item, reversedList) ); }    }### Answer:
@Test public void shouldReverseAnEmptyList() { final List<String> list = emptyList(); final List<String> actual = Exercise4.reverse(list); assertTrue(actual.isEmpty()); }
@Test public void shouldReverseAOneElementList() { final List<String> list = singletonList("Test"); final List<String> expected = singletonList("Test"); final List<String> actual = Exercise4.reverse(list); assertThat(actual, is(expected)); }
@Test public void shouldReverseAList() { final List<Integer> list = asList(1, 2, 3, 4); final List<Integer> expected = asList(4, 3, 2, 1); final List<Integer> actual = Exercise4.reverse(list); assertThat(actual, is(expected)); }